From 35e226de6bd8bb5a6171a553c7af3bb9fb463fbf Mon Sep 17 00:00:00 2001 From: Huck Boles Date: Thu, 6 Jul 2023 18:21:49 -0500 Subject: [PATCH] fixed: rust lsp better lazy loading --- lua/plugins/lsp.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index d620f0b..db7aafd 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -47,7 +47,7 @@ return { end require("mason-null-ls").setup({ - automatic_installation = true, + automatic_installation = false, handlers = { function() end, @@ -113,7 +113,6 @@ return { -- servers to setup local lsp = require("lspconfig") - lsp.awk_ls.setup({ on_attach = keybinds }) lsp.bashls.setup({ on_attach = keybinds }) lsp.clangd.setup({ on_attach = keybinds }) lsp.cssls.setup({ on_attach = keybinds }) @@ -133,7 +132,7 @@ return { vim.highlight.priorities.semantic_tokens = 95 -- custom signs - local signs = { Error = ">>", Warn = "> ", Hint = "- ", Info = " " } + local signs = { Error = ">>", Warn = "> ", Hint = "- ", Info = "* " } for type, icon in pairs(signs) do local hl = "DiagnosticSign" .. type vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) @@ -158,7 +157,7 @@ return { { 'simrat39/rust-tools.nvim', - ft = "rust", + event = { "BufReadPost *.rs" }, config = function() local rust = require("rust-tools") @@ -176,6 +175,7 @@ return { } }, server = { + standalone = false, settings = { ['rust-analyzer'] = { completion = { @@ -206,6 +206,14 @@ return { } } ) + + -- auto format code on save + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = { "*" }, + callback = function() + vim.lsp.buf.format() + end, + }) end }, } -- 2.45.2