[Feature] let flutter.workspace.ignore pass to ignoredRootPaths of LanguageClientOptions
- Dominant language
- TypeScript
- Stars
- 478
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
> @dkbast Have the similar issue but workaround well as the following:
>
> 1. make the package be the local dependency of the example project, you may configure like ../ on dependency_overrides to the pubspec of example.
> 2. cd to example dir in your terminal emulator.
> 3. open vim/nvim editor without args.
> 4. `:e lib/main.dart` (In my experience it must firstly open one dart file which belongs to example project, otherwise the lsp doesn't work well for dart files of example project if you open a dart file of package project at once)
> 5. At last, with cocconfig I mentioned above, you will see the lsp works both in example and package project.
Finally, I found another way to work properly without `cd` into the `example` folder:
**Background**:
The whole project structure may be like:
```
. (package project root)
├── CHANGELOG.md
├── LICENSE
├── README.md
├── example
│ ├── README.md
│ ├── android/
│ ├── example.iml
│ ├── ios/
│ ├── lib/main.dart
│ ├── pubspec.lock
│ ├── pubspec.yaml
│ ├── test/
├── lib/
├── pubspec.lock
├── pubspec.yaml
└── test/
```
Since default rootPatterns of workspace when you open dart files is like:
{"global": [".git", ".hg", ".projections.json"], "buffer": [], "server": ["pubspec.yaml"]}
Coc.nvim recognize workspaces by this patterns when you once open a file.
By default, when opening example/lib/main.dart from package project root path, Coc use up-bottom mode to specify the workspace, which only treats the package project root path as the workspace rather than the example folder, which causes commands such as `flutter.run` cannot found the entry lib/main.dart file, even though you append args `-t example/lib/main.dart`.
**To solve the issue**:
1. Set workspace.bottomUpFiletypes, such as
```json
{
...
"workspace.bottomUpFiletypes": ["dart", "yaml"],
...
}
```
2. Enter (neo)vim from package project root path, then open a dart file or yaml file under example folder, then the flutter commands works well.
**But there is an issue left:**
Since no exclusive `config` for rootPattern of coc's workspace and `flutter.workspaceFolder.ignore` is not be passed to the coc's LanguageClient, the `CocList files/grep -workspace` includes the unexpected files in workspace folders that should also be ignored.
For example:
As the setting is
```json
"flutter.workspaceFolder.ignore": [
"~/.pub-cache/",
"~/.config/",
"~/.dotfiles/"
],
```
The ~/.pub-cache/** should be expected excluded when `CocList -workspace files/grep`, which is still treated as coc's workspace folder.
**Request**:
pass **flutter.workspaceFolder.ignore** to [ignoredRootPath](https://github.com/neoclide/coc.nvim/blob/2fb58dc009d020bf441788ebc9dc1bd21cdb73cc/data/schema.json#L127)
_Originally posted by @changyiyao in https://github.com/iamcco/coc-flutter/issues/134#issuecomment-925488339_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.