{"id":13600699,"url":"https://github.com/iamcco/coc-flutter","last_synced_at":"2025-04-05T18:05:00.749Z","repository":{"id":40307139,"uuid":"213129239","full_name":"iamcco/coc-flutter","owner":"iamcco","description":"flutter support for (Neo)vim","archived":false,"fork":false,"pushed_at":"2023-09-11T10:32:16.000Z","size":666,"stargazers_count":472,"open_issues_count":23,"forks_count":38,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-12T18:48:17.042Z","etag":null,"topics":["autocomplete","coc","flutter","lsp","neovim","vim"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamcco.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"custom":"https://github.com/iamcco/markdown-preview.nvim#buy-me-a-coffee-%EF%B8%8F"}},"created_at":"2019-10-06T07:56:36.000Z","updated_at":"2024-09-23T11:26:49.000Z","dependencies_parsed_at":"2024-01-16T23:26:13.151Z","dependency_job_id":"63e06355-d2bb-4c04-b699-b3128f65048e","html_url":"https://github.com/iamcco/coc-flutter","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamcco%2Fcoc-flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamcco%2Fcoc-flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamcco%2Fcoc-flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamcco%2Fcoc-flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamcco","download_url":"https://codeload.github.com/iamcco/coc-flutter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378135,"owners_count":20929296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autocomplete","coc","flutter","lsp","neovim","vim"],"created_at":"2024-08-01T18:00:46.850Z","updated_at":"2025-04-05T18:05:00.721Z","avatar_url":"https://github.com/iamcco.png","language":"TypeScript","funding_links":["https://github.com/iamcco/markdown-preview.nvim#buy-me-a-coffee-%EF%B8%8F"],"categories":["Language Support","TypeScript"],"sub_categories":[],"readme":"# ![](https://flutter.dev/images/favicon.png) coc-flutter\n\nFlutter support for (Neo)vim\n\n![2019-10-07 23-31-40 2019-10-08 00_04_07](https://user-images.githubusercontent.com/5492542/66328510-58a6c480-e95f-11e9-95ca-0b4ed7c8e83f.gif)\n\n## Features\n\n- LSP features is power by [analysis_server](https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md)\n  - autocomplete\n  - diagnostics\n  - format\n  - rename\n  - hover document\n  - signature help\n  - go to definition\n  - go to implementation\n  - go to references\n  - document highlight\n  - document symbol\n  - code actions\n  - [more detail](https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md)\n    \u003e need flutter sdk and add to `PATH` environment\n- Automatically finds SDKs from PATH\n- Automatic hot reloads on save\n- Automatically run `flutter pub get` when `pubspec.yaml` change\n- Support flutter dev server\n- Snippet enhance `flutter.provider.enableSnippet`\n- Sdk switching\n- Devices List\n- Emulators List\n\n## Install\n\n`:CocInstall coc-flutter`\n\n\u003e **NOTE**: install `dart-vim-plugin` plugin if your (neo)vim detect filetype incorrect\n\nMost likely the extension will find your sdk automatically as long as the `flutter` command maps to an sdk location on your system.\n\nIf you are using a version manager like `asdf` that maps the `flutter` command to another binary instead of an sdk location or this extension cannot find your sdk for another reason you'll have to provide the extension with how to find your sdk.\nTo do this there are a few options:\n1. If your version manager supports a `which` command like then you can set the `flutter.sdk.flutter-lookup` config option. Eg. `\"flutter.sdk.flutter-lookup\": \"asdf which flutter\"`.\n2. You can add the path where to find the sdk to the `flutter.sdk.searchPaths` config option.\n   Either specify the exact folder the sdk is installed in or a folder that contains other folders which directly have an sdk in them. *Note that not all of these folders need to have an sdk, if they don't contain one they will simply be ignored*\n3. Set the `flutter.sdk.path` config option to the exact path you want to use for your sdk.\n   If you have also set the `flutter.sdk.searchPaths` then you can use the `FlutterSDKs` list (see below) to see what versions you have installed and set the config option for you. **Note that this means that the `flutter.sdk.path` option will be overriden by this list**\n\n## Running the app\n\nWhen the extension starts and has found an sdk it will request from flutter the available devices.\nThe device it will run the app on will be shown in the statusbar and can be changed using the `FlutterDevices` list.\nIf you call `flutter.run` with an explicit `-d deviceId` argument then the selected device will be ignored.\n\nAfter making sure that the correct device is selected you can run the app by calling the `flutter.run`:\n\u003e :CocCommand flutter.run\n\nIf you want to give arguments to the flutter run command you can simply append them:\n\u003e :CocCommand flutter.run -t lib/main.dart --flavor myflavor\n\n\n## coc-list sources\n\n- FlutterSDKs\n  \u003e `:CocList FlutterSDKs`\n\n  Shows all the sdks that can be found by using the `searchPaths` config and the `flutter-lookup` config options and allows you to switch between them, either only for your current workspace or globally.\n  Besides those two ways to find sdks it also checks if you are using fvm and if so uses those directories to find your sdk.\n  *You can disable this using the `flutter.fvm.enabled` config option.*\n\n  You can also use this list to see what your current sdk is since it will have `(current)` behind it clearly.\n\n- FlutterDevices\n  \u003e `:CocList FlutterDevices`\n\n  Shows a list of available devices that can be selected to use as run destination.\n  When selecting a device it will by default be stored in the `workspaceState` such that a device can be selected on a per project basis.\n  If no device is stored yet in the `workspaceState` it will fall back to the `globalState` and otherwise simply use the first device reported by flutter.\n  It also has the `run` action which only runs the app once on that device without changing the selected device.\n\n  You can configure the default action that us used using the `flutter.devicesDefaultAction` config option as described below.\n\n- FlutterEmulators\n  \u003e `:CocList FlutterEmulators`\n\n  Shows emulators available to start.\n\n## Settings\n\n- `flutter.trace.server` default: `off`\n  \u003e Trace level of log\n\n- `flutter.enabled` default: `true`\n  \u003e Enable coc-flutter extension\n\n- `flutter.lsp.debug` default: `false`\n  \u003e Enable debug for language server\n\n- `flutter.lsp.initialization.onlyAnalyzeProjectsWithOpenFiles`: default: `true`\n  \u003e When set to true, analysis will only be performed for projects that have open files rather than the root workspace folder.\n\n- `flutter.lsp.initialization.suggestFromUnimportedLibraries`: default: `true`\n  \u003e When set to false, completion will not include synbols that are not already imported into the current file\n\n- `[flutter.lsp.initialization.closingLabels](#closing-labels)`: default: `true`\n  \u003e When set to true, will display closing labels at end of closing, only neovim support.\n\n- `flutter.sdk.searchPaths` default: `[]`\n  \u003e the paths to search for flutter sdks, either directories where flutter is installed or directories which contain directories where flutter versions have been installed\n  \u003e eg. `/path/to/flutter` (command at `/path/to/flutter/bin/flutter`) or\n  \u003e `~/flutter_versions` (command at `~/flutter_versions/version/bin/flutter`).\n\n- `flutter.sdk.dart-command` default: `''`\n  \u003e dart command, leave empty should just work\n\n- `flutter.sdk.dart-lookup` default: `''`\n  \u003e (**only use this if you don't have a flutter installation but only dart**) command to find dart executable location, used to infer dart-sdk location\n\n- `flutter.sdk.flutter-lookup` default: `''`\n  \u003e command to find flutter executable location, used to infer location of dart-sdk in flutter cache\n\n- `flutter.provider.hot-reload` default: `true`\n  \u003e Enable hot reload after save.\n  \u003e Only when there are no errors for the save file\n\n- `flutter.provider.enableSnippet` Enable completion item snippet, default: `true`\n  - `import '';` =\u003e `import '${1}';${0}`\n  - `someName(…)` =\u003e `someName(${1})${0}`\n  - `setState(() {});` =\u003e `setState(() {\\n\\t${1}\\n});${0}`\n\n- `flutter.openDevLogSplitCommand` default: `''`\n  \u003e  Vim command to open dev log window, like: `botright 10split`\n\n- `flutter.workspaceFolder.ignore` default: `[]`\n  \u003e Path start within the list will not treat as workspaceFolder.\n  \u003e Also flutter sdk will not treat as workspaceFolder, more detail issues [50](https://github.com/iamcco/coc-flutter/issues/50)\n\n- `flutter.runDevToolsAtStartup` default: `false`\n  \u003e Automatically open devtools debugger web page when a project is run\n\n- `flutter.autoOpenDevLog` default: `false`\n  \u003e Automatically open the dev log after calling flutter run\n\n- `flutter.autoHideDevLog` default: `false`\n  \u003e Automatically hide the dev log when the app stops running\n\n- `flutter.selectedDeviceId` default: `null`\n  \u003e The id of the device that was last selected using the FlutterDevices list (only if the device is selected using one of the `config` actions).\n\n- `flutter.devicesDefaultAction` default: `workspaceState`\n  \u003e The default action to use when pressing enter in the `FlutterDevices` list.\n  \u003e The `state` options will store the selected device in coc's `memos.json` file.\n  \u003e The `config` options will store the selected device in the `coc-settings.json` file.\n\n- `dart.analysisExcludedFolders` default: `[]`\n  \u003e An array of paths (absolute or relative to each workspace folder) that should be excluded from analysis.\n\n- `dart.enableSdkFormatter` default: `true`\n  \u003e When set to false, prevents registration (or unregisters) the SDK formatter. When set to true or not supplied, will register/reregister the SDK formatter.\n\n- `dart.lineLength` default: `80`\n  \u003e The number of characters the formatter should wrap code at. If unspecified, code will be wrapped at 80 characters.\n\n- `dart.completeFunctionCalls` default: `true`\n  \u003e Completes functions/methods with their required parameters.\n\n- `dart.showTodos` default: `true`\n  \u003e Whether to generate diagnostics for TODO comments. If unspecified, diagnostics will not be generated.\n\n\n**Enable format on save**:\n\n```jsonc\n\"coc.preferences.formatOnSaveFiletypes\": [\n  \"dart\"\n],\n```\n\n## Code Actions\n\nAdd below config mapping\n\n\u003e this config should be in the coc.nvim README\n\n``` vim\nxmap \u003cleader\u003ea  \u003cPlug\u003e(coc-codeaction-selected)\nnmap \u003cleader\u003ea  \u003cPlug\u003e(coc-codeaction-selected)\n```\n\nApplying codeAction to the selected region.\n\nExample: `\u003cleader\u003eaap` for current paragraph, `\u003cleader\u003eaw` for the current word\n\nThen you will see action list:\n\n- Wrap with Widget\n- Wrap with Center\n- etc\n\n## Commands\n\nOpen flutter only commands list: `CocList --input=flutter commands`\n\n**Global Commands**:\n\n- `flutter.run` Run flutter dev server\n- `flutter.attach` Attach running application\n- `flutter.create` Create flutter project using: `flutter create`\n- `flutter.doctor` Run: `flutter doctor`\n- `flutter.upgrade` Run: `flutter upgrade`\n- `flutter.pub.get` Run: `flutter pub get`\n- `flutter.devices` open devices list\n- `flutter.emulators` open emulators list\n\n**LSP Commands**\n\n- `flutter.gotoSuper` jump to the location of the super definition of the class or method\n\n**Dev Server Commands**:\n\n\u003e available when dev server running\n\n- `flutter.dev.quit` Quit server\n- `flutter.dev.detach` Detach server\n- `flutter.dev.hotReload` Hot reload\n- `flutter.dev.hotRestart` Hot restart\n- `flutter.dev.screenshot` To save a screenshot to flutter.png\n- `flutter.dev.openDevLog` Open flutter dev server log\n- `flutter.dev.clearDevLog` Clear the flutter dev server log\n- `flutter.dev.openProfiler` Open observatory debugger and profiler web page\n- `flutter.dev.copyProfilerUrl` Copy the url of observatory debugger and profiler web page to the system clipboard (register +)\n- `flutter.dev.openDevToolsProfiler` Open devtools debugger web page\n- `flutter.dev.debugDumpAPP` You can dump the widget hierarchy of the app (debugDumpApp)\n- `flutter.dev.elevationChecker` To toggle the elevation checker\n- `flutter.dev.debugDumpLayerTree` For layers (debugDumpLayerTree)\n- `flutter.dev.debugDumpRenderTree` To dump the rendering tree of the app (debugDumpRenderTree)\n- `flutter.dev.debugPaintSizeEnabled` To toggle the display of construction lines (debugPaintSizeEnabled)\n- `flutter.dev.defaultTargetPlatform` To simulate different operating systems, (defaultTargetPlatform)\n- `flutter.dev.showPerformanceOverlay` To display the performance overlay (WidgetsApp.showPerformanceOverlay)\n- `flutter.dev.debugProfileWidgetBuilds` To enable timeline events for all widget build methods, (debugProfileWidgetBuilds)\n- `flutter.dev.showWidgetInspectorOverride` To toggle the widget inspector (WidgetsApp.showWidgetInspectorOverride)\n- `flutter.dev.debugDumpSemanticsHitTestOrder` Accessibility (debugDumpSemantics) for inverse hit test order\n- `flutter.dev.debugDumpSemanticsTraversalOrder` Accessibility (debugDumpSemantics) for traversal order\n\n### Closing Labels\n\nwhen `flutter.lsp.initialization.closingLabels` is true,\nthe closing labels will be display at end of closing.\n\n\u003e this feature only support neovim since vim do not support virtual text\n\n| disabled                                                                                                                         | enabled                                                                                                                          |\n| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |\n| \u003cimg height=\"300px\" src=\"https://user-images.githubusercontent.com/5492542/67616073-f0812b00-f806-11e9-8e5c-ac42ab3a293c.png\" /\u003e | \u003cimg height=\"300px\" src=\"https://user-images.githubusercontent.com/5492542/67616063-c16ab980-f806-11e9-8522-1c89217096e0.png\" /\u003e |\n\n### Buy Me A Coffee ☕️\n\n![btc](https://img.shields.io/keybase/btc/iamcco.svg?style=popout-square)\n\n![image](https://user-images.githubusercontent.com/5492542/42771079-962216b0-8958-11e8-81c0-520363ce1059.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamcco%2Fcoc-flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamcco%2Fcoc-flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamcco%2Fcoc-flutter/lists"}