Skip to content

Commit cdc0bb3

Browse files
authored
updated vim.md regarding breaking change in neovim 0.11
https://neovim.io/doc/user/news-0.11.html#_lsp
1 parent 578c121 commit cdc0bb3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

gopls/doc/vim.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,12 @@ Use the following configuration to have your imports organized on save using
174174
the logic of `goimports` and your code formatted.
175175

176176
```lua
177-
autocmd("BufWritePre", {
177+
vim.api.nvim_create_autocmd("BufWritePre", {
178178
pattern = "*.go",
179179
callback = function()
180-
local params = vim.lsp.util.make_range_params()
181-
params.context = {only = {"source.organizeImports"}}
180+
local params = vim.lsp.util.make_range_params(0, "utf-8")
181+
params.context = { only = { "source.organizeImports" } }
182+
182183
-- buf_request_sync defaults to a 1000ms timeout. Depending on your
183184
-- machine and codebase, you may want longer. Add an additional
184185
-- argument after params if you find that you have to write the file
@@ -193,11 +194,12 @@ autocmd("BufWritePre", {
193194
end
194195
end
195196
end
196-
vim.lsp.buf.format({async = false})
197+
vim.lsp.buf.format({ async = false })
197198
end
198199
})
199200
```
200201

202+
201203
### <a href="#neovim-omnifunc" id="neovim-omnifunc">Omnifunc</a>
202204

203205
In Neovim v0.8.1 and later if you don't set the option `omnifunc`, it will auto

0 commit comments

Comments
 (0)