diff --git a/gopls/doc/vim.md b/gopls/doc/vim.md index 51f19ddc50..4563c28746 100644 --- a/gopls/doc/vim.md +++ b/gopls/doc/vim.md @@ -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`: