Ⅰ. 插件描述
flutter support for (Neo)vimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'iamcco/coc-flutter'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'iamcco/coc-flutter'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'iamcco/coc-flutter'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/iamcco/coc-flutter
Ⅳ. 文档说明
#
coc-flutter
Flutter support for (Neo)vim

Features
LSP features is power by analysis_server
- autocomplete
- diagnostics
- format
- rename
- hover document
- signature help
- go to definition
- go to implementation
- go to references
- document highlight
- document symbol
- code actions
- more detail
need flutter sdk and add to
PATHenvironment- Automatically finds SDKs from PATH
- Automatic hot reloads on save
- Automatically run
flutter pub getwhenpubspec.yamlchange - Support flutter dev server
- Snippet enhance
flutter.provider.enableSnippet - Devices List
- Emulators List
Install
:CocInstall coc-flutter
coc-list sources
- FlutterDevices
:CocList FlutterDevices
- FlutterEmulators
:CocList FlutterEmulators
Settings
flutter.trace.serverTrace level of log, default:offflutter.enabledEnable coc-flutter extension, default:trueflutter.lsp.debugEnable debug for language server, default:falseflutter.lsp.initialization.onlyAnalyzeProjectsWithOpenFiles: defalut:false
When set to true, analysis will only be performed for projects that have open files rather than the root workspace folder.
flutter.lsp.initialization.suggestFromUnimportedLibraries: defalut:true
When set to false, completion will not include synbols that are not already imported into the current file
flutter.lsp.initialization.closingLabels: defalut:true
When set to true, will display closing labels at end of closing, only neovim support.
flutter.sdk.dart-commanddart command, leave empty should just work, default:''flutter.sdk.dart-lookupcommand to find dart executable location, used to infer dart-sdk location, default:''flutter.sdk.flutter-lookupcommand to find flutter executable location, used to infer location of dart-sdk in flutter cache:''flutter.provider.hot-reloadEnable hot reload after save, default:true
only when there are no errors for the save file
flutter.provider.enableSnippetEnable completion item snippet, default: trueimport '';=>import '${1}';${0}someName(…)=>someName(${1})${0}setState(() {});=>setState(() {\n\t${1}\n});${0}
Enable format on save:
"coc.preferences.formatOnSaveFiletypes": [
"dart"
],Commands
Open flutter only commands list: CocList --input=flutter commands
Global Commands:
flutter.runRun flutter dev serverflutter.createCreate flutter project using:flutter createflutter.doctorRun:flutter doctorflutter.upgradeRun:flutter upgradeflutter.pub.getRun:flutter pub getflutter.devicesopen devices listflutter.emulatorsopen emulators list
LSP Commands
flutter.gotoSuperjump to the location of the super definition of the class or method
Dev Server Commands:
available when dev server running
flutter.dev.quitQuit serverflutter.dev.detachDetach serverflutter.dev.hotReloadHot reloadflutter.dev.hotRestartHot restartflutter.dev.screenshotTo save a screenshot to flutter.pngflutter.dev.openDevLogOpen flutter dev server logflutter.dev.openProfilerOpen observatory debugger and profiler web pageflutter.dev.debugDumpAPPYou can dump the widget hierarchy of the app (debugDumpApp)flutter.dev.elevationCheckerTo toggle the elevation checkerflutter.dev.debugDumpLayerTreeFor layers (debugDumpLayerTree)flutter.dev.debugDumpRenderTreeTo dump the rendering tree of the app (debugDumpRenderTree)flutter.dev.debugPaintSizeEnabledTo toggle the display of construction lines (debugPaintSizeEnabled)flutter.dev.defaultTargetPlatformTo simulate different operating systems, (defaultTargetPlatform)flutter.dev.showPerformanceOverlayTo display the performance overlay (WidgetsApp.showPerformanceOverlay)flutter.dev.debugProfileWidgetBuildsTo enable timeline events for all widget build methods, (debugProfileWidgetBuilds)flutter.dev.showWidgetInspectorOverrideTo toggle the widget inspector (WidgetsApp.showWidgetInspectorOverride)flutter.dev.debugDumpSemanticsHitTestOrderAccessibility (debugDumpSemantics) for inverse hit test orderflutter.dev.debugDumpSemanticsTraversalOrderAccessibility (debugDumpSemantics) for traversal order
Closing Labels
when flutter.lsp.initialization.closingLabels is true,
the closing labels will be display at end of closing.
this feature only support neovim since vim do not support virtual text
| disabled | enabled |
|---|---|
![]() | ![]() |
Buy Me A Coffee ☕️


