diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-01 18:20:53 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-01 18:20:53 +0000 |
commit | c0d3e315e33e8d95d064bfe2c276858dd802fd0d (patch) | |
tree | 5edb4b869c26c167e53e3910dea2d4d4a043dcdb | |
parent | 4131e88bb7b62db5743cdf5a9ed01e3cababc5ea (diff) | |
parent | 84c324b3dd84a191defcc490a6308a5f5c16a7f5 (diff) |
Merge #7509
7509: Improve nvim-lsp setup instructions r=lnicola a=lnicola
bors r+
Co-authored-by: Laurențiu Nicola <[email protected]>
-rw-r--r-- | docs/user/manual.adoc | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index 990b11859..10d4fd606 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc | |||
@@ -272,7 +272,40 @@ let g:ale_linters = {'rust': ['analyzer']} | |||
272 | 272 | ||
273 | NeoVim 0.5 (not yet released) has built-in language server support. | 273 | NeoVim 0.5 (not yet released) has built-in language server support. |
274 | For a quick start configuration of rust-analyzer, use https://github.com/neovim/nvim-lspconfig#rust_analyzer[neovim/nvim-lspconfig]. | 274 | For a quick start configuration of rust-analyzer, use https://github.com/neovim/nvim-lspconfig#rust_analyzer[neovim/nvim-lspconfig]. |
275 | Once `neovim/nvim-lspconfig` is installed, use `+lua require'nvim_lsp'.rust_analyzer.setup({})+` in your `init.vim`. | 275 | Once `neovim/nvim-lspconfig` is installed, use `+lua require'lspconfig'.rust_analyzer.setup({})+` in your `init.vim`. |
276 | |||
277 | You can also pass LSP settings to the server: | ||
278 | |||
279 | [source,vim] | ||
280 | ---- | ||
281 | lua << EOF | ||
282 | local nvim_lsp = require'lspconfig' | ||
283 | |||
284 | local on_attach = function(client) | ||
285 | require'completion'.on_attach(client) | ||
286 | end | ||
287 | |||
288 | nvim_lsp.rust_analyzer.setup({ | ||
289 | on_attach=on_attach, | ||
290 | settings = { | ||
291 | ["rust-analyzer"] = { | ||
292 | assist = { | ||
293 | importMergeBehavior = "last", | ||
294 | importPrefix = "by_self", | ||
295 | }, | ||
296 | cargo = { | ||
297 | loadOutDirsFromCheck = true | ||
298 | }, | ||
299 | procMacro = { | ||
300 | enable = true | ||
301 | }, | ||
302 | } | ||
303 | } | ||
304 | }) | ||
305 | EOF | ||
306 | ---- | ||
307 | |||
308 | See https://sharksforarms.dev/posts/neovim-rust/ for more tips on getting started. | ||
276 | 309 | ||
277 | === Sublime Text 3 | 310 | === Sublime Text 3 |
278 | 311 | ||