lsp: added rust and some notification management

This commit is contained in:
kossLAN 2024-10-20 20:33:05 -04:00
parent a5108f68c1
commit f7ae8e97b0
Signed by: kossLAN
SSH key fingerprint: SHA256:bdV0x+wdQHGJ6LgmstH3KV8OpWY+OOFmJcPcB0wQPV8
6 changed files with 59 additions and 2 deletions

40
nvim/ftplugin/rust.lua Normal file
View file

@ -0,0 +1,40 @@
-- Exit if the language server isn't available
if vim.fn.executable('rust-analyzer') ~= 1 then
return
end
local root_files = {
'Cargo.toml',
'rust-project.json',
}
-- Tab Width
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2
vim.bo.expandtab = true
vim.lsp.start {
name = 'rust-analyzer',
cmd = { 'rust-analyzer' },
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
capabilities = require('user.lsp').make_client_capabilities(),
settings = {
['rust-analyzer'] = {
diagnostics = { enable = false },
imports = {
granularity = {
group = 'module',
},
prefix = 'self',
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
}