From 6e3fdd2efed29e0f251149b32ae1dc27f92b34b7 Mon Sep 17 00:00:00 2001 From: mightypanders Date: Thu, 13 Oct 2022 23:54:46 +0200 Subject: [PATCH] changes to rust lsp --- nvim/lua/new_lsp_conf.lua | 51 ++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/nvim/lua/new_lsp_conf.lua b/nvim/lua/new_lsp_conf.lua index d3161f6..dda0c02 100644 --- a/nvim/lua/new_lsp_conf.lua +++ b/nvim/lua/new_lsp_conf.lua @@ -36,17 +36,50 @@ local lsp_flags = { -- This is the default in Nvim 0.7+ debounce_text_changes = 150, } +local capabilities = require('cmp_nvim_lsp').update_capabilities( + vim.lsp.protocol.make_client_capabilities() +) require('mason-lspconfig').setup_handlers { function(server_name) require('lspconfig')[server_name].setup { on_attach = on_attach, flags = lsp_flags, + capabilities = capabilities } end, ['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, flags = lsp_flags, + -- server-specific settings... + settings = { + ["rust-analyzer"] = {} + } } end, ['sumneko_lua'] = function() @@ -63,11 +96,11 @@ require('mason-lspconfig').setup_handlers { } end, } -require('lspconfig')['rust_analyzer'].setup { - on_attach = on_attach, - flags = lsp_flags, - -- Server-specific settings... - settings = { - ["rust-analyzer"] = {} - } -} +--require('lspconfig')['rust_analyzer'].setup { +-- on_attach = on_attach, +-- flags = lsp_flags, +-- -- Server-specific settings... +-- settings = { +-- ["rust-analyzer"] = {} +-- } +--}