changes to rust lsp

This commit is contained in:
mightypanders 2022-10-13 23:54:46 +02:00
parent 9555ab88a1
commit 6e3fdd2efe
1 changed files with 42 additions and 9 deletions

View File

@ -36,17 +36,50 @@ local lsp_flags = {
-- This is the default in Nvim 0.7+ -- This is the default in Nvim 0.7+
debounce_text_changes = 150, debounce_text_changes = 150,
} }
local capabilities = require('cmp_nvim_lsp').update_capabilities(
vim.lsp.protocol.make_client_capabilities()
)
require('mason-lspconfig').setup_handlers { require('mason-lspconfig').setup_handlers {
function(server_name) function(server_name)
require('lspconfig')[server_name].setup { require('lspconfig')[server_name].setup {
on_attach = on_attach, on_attach = on_attach,
flags = lsp_flags, flags = lsp_flags,
capabilities = capabilities
} }
end, end,
['rust_analyzer'] = function() ['rust_analyzer'] = function()
require('rust-tools').setup { local rustToolsOpts = {
tools = {
inlay_hints = {
auto = true,
only_current_line = false,
show_parameter_hints = true,
parameter_hints_prefix = "<-",
}
},
server = {
on_attach = on_attach,
capabilities = capabilities,
flags = lsp_flags,
settings = {
["rust_analyzer"] = {
checkOnSave = {
command = "clippy"
}
}
}
}
}
require('rust-tools').setup(rustToolsOpts)
--on_attach = on_attach,
--flags = lsp_flags,
require('lspconfig')['rust_analyzer'].setup {
on_attach = on_attach, on_attach = on_attach,
flags = lsp_flags, flags = lsp_flags,
-- server-specific settings...
settings = {
["rust-analyzer"] = {}
}
} }
end, end,
['sumneko_lua'] = function() ['sumneko_lua'] = function()
@ -63,11 +96,11 @@ require('mason-lspconfig').setup_handlers {
} }
end, end,
} }
require('lspconfig')['rust_analyzer'].setup { --require('lspconfig')['rust_analyzer'].setup {
on_attach = on_attach, -- on_attach = on_attach,
flags = lsp_flags, -- flags = lsp_flags,
-- Server-specific settings... -- -- Server-specific settings...
settings = { -- settings = {
["rust-analyzer"] = {} -- ["rust-analyzer"] = {}
} -- }
} --}