Flutter support for (Neo)vim
- 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
PATH
environment
- Automatically finds SDKs from PATH
- Automatic hot reloads on save
- Automatically run
flutter pub get
whenpubspec.yaml
change - Support flutter dev server
- Snippet enhance
flutter.provider.enableSnippet
- Devices List
- Emulators List
:CocInstall coc-flutter
NOTE: install
dart-vim-plugin
plugin if your (neo)vim detect filetype incorrect
- FlutterDevices
:CocList FlutterDevices
- FlutterEmulators
:CocList FlutterEmulators
flutter.trace.server
Trace level of log, default:off
flutter.enabled
Enable coc-flutter extension, default:true
flutter.lsp.debug
Enable debug for language server, default:false
flutter.lsp.initialization.onlyAnalyzeProjectsWithOpenFiles
: default: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
: default:true
When set to false, completion will not include synbols that are not already imported into the current file
flutter.lsp.initialization.closingLabels
: default:true
When set to true, will display closing labels at end of closing, only neovim support.
flutter.sdk.dart-command
dart command, leave empty should just work, default:''
flutter.sdk.dart-lookup
command to find dart executable location, used to infer dart-sdk location, default:''
flutter.sdk.flutter-lookup
command to find flutter executable location, used to infer location of dart-sdk in flutter cache:''
flutter.provider.hot-reload
Enable hot reload after save, default:true
only when there are no errors for the save file
flutter.provider.enableSnippet
Enable completion item snippet, default: trueimport '';
=>import '${1}';${0}
someName(…)
=>someName(${1})${0}
setState(() {});
=>setState(() {\n\t${1}\n});${0}
flutter.openDevLogSplitCommand
Vim command to open dev log window, like:botright 10split
, default: ''
Enable format on save:
"coc.preferences.formatOnSaveFiletypes": [
"dart"
],
Add below config mapping
this cofig should be in the coc.nvim README
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
Applying codeAction to the selected region.
Example: <leader>aap
for current paragraph, <leader>aw
for the current word
Then you will see action list:
- Wrap with Widget
- Waap with Center
- etc
Open flutter only commands list: CocList --input=flutter commands
Global Commands:
flutter.run
Run flutter dev serverflutter.attach
Attach running applicationflutter.create
Create flutter project using:flutter create
flutter.doctor
Run:flutter doctor
flutter.upgrade
Run:flutter upgrade
flutter.pub.get
Run:flutter pub get
flutter.devices
open devices listflutter.emulators
open emulators list
LSP Commands
flutter.gotoSuper
jump to the location of the super definition of the class or method
Dev Server Commands:
available when dev server running
flutter.dev.quit
Quit serverflutter.dev.detach
Detach serverflutter.dev.hotReload
Hot reloadflutter.dev.hotRestart
Hot restartflutter.dev.screenshot
To save a screenshot to flutter.pngflutter.dev.openDevLog
Open flutter dev server logflutter.dev.openProfiler
Open observatory debugger and profiler web pageflutter.dev.debugDumpAPP
You can dump the widget hierarchy of the app (debugDumpApp)flutter.dev.elevationChecker
To toggle the elevation checkerflutter.dev.debugDumpLayerTree
For layers (debugDumpLayerTree)flutter.dev.debugDumpRenderTree
To dump the rendering tree of the app (debugDumpRenderTree)flutter.dev.debugPaintSizeEnabled
To toggle the display of construction lines (debugPaintSizeEnabled)flutter.dev.defaultTargetPlatform
To simulate different operating systems, (defaultTargetPlatform)flutter.dev.showPerformanceOverlay
To display the performance overlay (WidgetsApp.showPerformanceOverlay)flutter.dev.debugProfileWidgetBuilds
To enable timeline events for all widget build methods, (debugProfileWidgetBuilds)flutter.dev.showWidgetInspectorOverride
To toggle the widget inspector (WidgetsApp.showWidgetInspectorOverride)flutter.dev.debugDumpSemanticsHitTestOrder
Accessibility (debugDumpSemantics) for inverse hit test orderflutter.dev.debugDumpSemanticsTraversalOrder
Accessibility (debugDumpSemantics) for traversal order
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 |
---|---|