-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
mason.txt
58 lines (52 loc) · 1.82 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
55
56
57
58
==============================================================================
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')
if mason_registry.is_installed('rust-analyzer') then
-- This may need to be tweaked depending on the operating system.
local ra = mason_registry.get_package('rust-analyzer')
local ra_filename = ra:get_receipt():get().links.bin['rust-analyzer']
return { ('%s/%s'):format(ra:get_install_path(), ra_filename or 'rust-analyzer') }
else
-- global installation
return { 'rust-analyzer' }
end
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: