55 lines
1.7 KiB
Plaintext
55 lines
1.7 KiB
Plaintext
==============================================================================
|
|
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:
|