forked from mrcjkb/rustaceanvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mason.txt
54 lines (48 loc) · 1.74 KB
/
mason.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
==============================================================================
mason-lspconfig troubleshooting *rustaceanvim.mason*
This plugin supports automatically detecting mason.nvim codelldb installations,
but not rust-analyzer.
The main reason for this choice is that it mason.nvim installations of rust-analyzer
will most likely have been built with a different toolchain than your project,
leading to inconsistencies and possibly subtle bugs.
If you want to use a mason.nvim installation anyway, you can do so by specifying
the `server.cmd` setting (see |rustaceanvim.config| and |RustaceanLspClientOpts|):
>lua
vim.g.rustaceanvim = {
server = {
cmd = function()
local mason_registry = require('mason-registry')
local ra_binary = mason_registry.is_installed('rust-analyzer')
-- This may need to be tweaked, depending on the operating system.
and mason_registry.get_package('rust-analyzer'):get_install_path() .. "/rust-analyzer"
or "rust-analyzer"
return { ra_binary } -- You can add args to the list, such as '--log-file'
end,
},
}
<
Note that mason-lspconfig.nvim, when configured to ensure rust-analyzer is installed,
assumes you are using the `nvim-lspconfig.rust_analyzer` client.
Some Neovim distributions will automatically call the client's `setup`
function, resulting in a conflict with this plugin.
General approach to prevent mason-lspconfig from setting up
`lspconfig.rust_analyzer`:
>lua
require('mason-lspconfig').setup_handlers {
['rust_analyzer'] = function() end,
}
<
Using LazyVim:
>lua
{
'neovim/nvim-lspconfig',
opts = {
setup = {
rust_analyzer = function()
return true
end,
},
},
}
<
vim:tw=78:ts=8:noet:ft=help:norl: