From 4a04c8dae449bf983342e1647f963644156dac74 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Fri, 3 May 2024 14:27:26 +0100 Subject: Added rust LSP, cleaned up a little --- lsp.lua | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'lsp.lua') diff --git a/lsp.lua b/lsp.lua index fabb8d5..5ffce6d 100644 --- a/lsp.lua +++ b/lsp.lua @@ -34,16 +34,16 @@ end -- better UI vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( - vim.lsp.handlers.hover, { - -- Use a sharp border with `FloatBorder` highlights - border = "single" - } +vim.lsp.handlers.hover, { + -- Use a sharp border with `FloatBorder` highlights + border = "single" +} ) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( - vim.lsp.handlers.signature_help, { - -- Use a sharp border with `FloatBorder` highlights - border = "single" - } +vim.lsp.handlers.signature_help, { + -- Use a sharp border with `FloatBorder` highlights + border = "single" +} ) -- Use a loop to conveniently call 'setup' on multiple servers and @@ -70,14 +70,28 @@ local servers = { lua_ls = { lua_ls = { }, }, + rust_analyzer = { + ["rust-analyzer"] = { + imports = { + granularity = { + group = "module", + }, + prefix = "self", + }, + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { + enable = true + }, + }, + }, } for lsp, settings in pairs(servers) do require('lspconfig')[lsp].setup { on_attach = on_attach, - flags = { - -- This will be the default in neovim 0.7+ - debounce_text_changes = 150, - }, settings = settings, } end @@ -88,5 +102,5 @@ vim.diagnostic.config({ virtual_text = true, signs = true }) require("trouble").setup() vim.api.nvim_set_keymap("n", "xx", "TroubleToggle", - {silent = true, noremap = true} +{silent = true, noremap = true} ) -- cgit v1.2.3