]> git.huck.website - nvim.git/commitdiff
fixed: rust lsp better lazy loading
authorHuck Boles <huck@huck.website>
Thu, 6 Jul 2023 23:21:49 +0000 (18:21 -0500)
committerHuck Boles <huck@huck.website>
Thu, 6 Jul 2023 23:21:49 +0000 (18:21 -0500)
lua/plugins/lsp.lua

index d620f0bb8ab9830f0504da1763e8ee20a7a0846a..db7aafd59349ead98c6b04ede06f23c921268181 100644 (file)
@@ -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
     },
 }