aboutsummaryrefslogtreecommitdiff
path: root/docs/user/manual.adoc
diff options
context:
space:
mode:
authorIlya Bobyr <[email protected]>2021-02-04 02:49:59 +0000
committerIlya Bobyr <[email protected]>2021-02-08 04:24:56 +0000
commit9ffe4ca26ce473d165e2fb925c6dedf7abad1591 (patch)
tree150b02bc54dd0eb8e273ee7b88708a970fbdf896 /docs/user/manual.adoc
parent6781692732d04968fe8ce09ded59f2faae492d82 (diff)
Vim docs: vim-lsp with initial configuration.
`vim-lsp` is another popular LSP client for Vim. And, as there is no `rust-analyzer` specific UI, it is non-trivial to figure out how the initial configuration is performed.
Diffstat (limited to 'docs/user/manual.adoc')
-rw-r--r--docs/user/manual.adoc46
1 files changed, 46 insertions, 0 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc
index 93bf6d678..a1018b0cb 100644
--- a/docs/user/manual.adoc
+++ b/docs/user/manual.adoc
@@ -307,6 +307,52 @@ EOF
307 307
308See https://sharksforarms.dev/posts/neovim-rust/ for more tips on getting started. 308See https://sharksforarms.dev/posts/neovim-rust/ for more tips on getting started.
309 309
310==== vim-lsp
311
312vim-lsp is installed by following https://github.com/prabirshrestha/vim-lsp[the plugin instructions].
313It can be as simple as adding this line to your `.vimrc`:
314
315[source,vim]
316----
317Plug 'prabirshrestha/vim-lsp'
318----
319
320Next you need to register the `rust-analyzer` binary.
321If it is available in `$PATH`, you may want to add this to your `.vimrc`:
322
323[source,vim]
324----
325if executable('rust-analyzer')
326 au User lsp_setup call lsp#register_server({
327 \ 'name': 'Rust Language Server',
328 \ 'cmd': {server_info->['rust-analyzer']},
329 \ 'whitelist': ['rust'],
330 \ })
331endif
332----
333
334There is no dedicated UI for the server configuration, so you would need to send any options as a value of the `initialization_options` field, as described in the <<_configuration,Configuration>> section.
335Here is an example of how to enable the proc-macro support:
336
337[source,vim]
338----
339if executable('rust-analyzer')
340 au User lsp_setup call lsp#register_server({
341 \ 'name': 'Rust Language Server',
342 \ 'cmd': {server_info->['rust-analyzer']},
343 \ 'whitelist': ['rust'],
344 \ 'initialization_options': {
345 \ 'cargo': {
346 \ 'loadOutDirsFromCheck': v:true,
347 \ },
348 \ 'procMacro': {
349 \ 'enable': v:true,
350 \ },
351 \ },
352 \ })
353endif
354----
355
310=== Sublime Text 3 356=== Sublime Text 3
311 357
312Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. 358Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.