mirror of
https://github.com/kossLAN/nvim-flake.git
synced 2025-11-05 02:09:49 -05:00
lsp: added rust and some notification management
This commit is contained in:
parent
a5108f68c1
commit
f7ae8e97b0
6 changed files with 59 additions and 2 deletions
40
nvim/ftplugin/rust.lua
Normal file
40
nvim/ftplugin/rust.lua
Normal 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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue