gopls: update coc.nvim documentation for using go.work

For golang/go#50955

Change-Id: Idab88d258ceab3312adccd97eb58ed64e5fb5053
Reviewed-on: https://go-review.googlesource.com/c/tools/+/382242
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Robert Findley 2022-02-01 14:20:33 -05:00
parent 597b165f5f
commit cf66aec62b
1 changed files with 8 additions and 1 deletions

View File

@ -93,7 +93,7 @@ Use [coc.nvim], with the following `coc-settings.json` configuration:
"languageserver": {
"golang": {
"command": "gopls",
"rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
"rootPatterns": ["go.work", "go.mod", ".vim/", ".git/", ".hg/"],
"filetypes": ["go"],
"initializationOptions": {
"usePlaceholders": true
@ -102,6 +102,13 @@ Use [coc.nvim], with the following `coc-settings.json` configuration:
}
```
If you use `go.work` files, you may want to set the
`workspace.workspaceFolderCheckCwd` option. This will force coc.nvim to search
parent directories for `go.work` files, even if the current open directory has
a `go.mod` file. See the
[coc.nvim documentation](https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders)
for more details.
Other [settings](settings.md) can be added in `initializationOptions` too.
The `editor.action.organizeImport` code action will auto-format code and add missing imports. To run this automatically on save, add the following line to your `init.vim`: