]> git.rmz.io Git - dotfiles.git/blobdiff - nvim/lua/plugins/lsp.lua
lazyvim: absorb icons into rmz.util.ui
[dotfiles.git] / nvim / lua / plugins / lsp.lua
index aa4f1848166e2c8bf167328f33630d9a05e904a6..d020443ec8815d679700aa70083e01ac7534516f 100644 (file)
@@ -3,90 +3,89 @@ return {
   {
     "neovim/nvim-lspconfig",
     ---@class PluginLspOpts
   {
     "neovim/nvim-lspconfig",
     ---@class PluginLspOpts
-    --
-    init = function ()
+    opts = function()
       local keys = require("lazyvim.plugins.lsp.keymaps").get()
       local keys = require("lazyvim.plugins.lsp.keymaps").get()
-
       -- TODO: setup a new mapping for this
       -- { "gr", "<cmd>Telescope lsp_references<cr>", desc = "References" },
       keys[#keys+1] = { "gr", false }
       -- TODO: setup a new mapping for this
       -- { "gr", "<cmd>Telescope lsp_references<cr>", desc = "References" },
       keys[#keys+1] = { "gr", false }
-    end,
-    opts = {
-      diagnostics = {
-        underline = true,
-        update_in_insert = false,
-        virtual_text = {
-          spacing = 4,
-          source = "if_mani",
-          prefix = "●",
-        },
-        severity_sort = true,
-        signs = {
-          text = {
-            [vim.diagnostic.severity.ERROR] = " ",
-            [vim.diagnostic.severity.WARN]  = " ",
-            [vim.diagnostic.severity.HINT]  = " ",
-            [vim.diagnostic.severity.INFO]  = " ",
+
+      return {
+        diagnostics = {
+          underline = true,
+          update_in_insert = false,
+          virtual_text = {
+            spacing = 4,
+            source = "if_mani",
+            prefix = "●",
+          },
+          severity_sort = true,
+          signs = {
+            text = {
+              [vim.diagnostic.severity.ERROR] = " ",
+              [vim.diagnostic.severity.WARN]  = " ",
+              [vim.diagnostic.severity.HINT]  = " ",
+              [vim.diagnostic.severity.INFO]  = " ",
+            },
           },
         },
           },
         },
-      },
-      inlay_hints = { enabled = false, },
-      codelens = { enabled = false, },
-      document_highlight = { enabled = true, },
-      capabilities = {
-        workspace = {
-          fileOperations = {
-            didRename = true,
-            willRename = true,
+        inlay_hints = { enabled = false, },
+        codelens = { enabled = false, },
+        document_highlight = { enabled = true, },
+        capabilities = {
+          workspace = {
+            fileOperations = {
+              didRename = true,
+              willRename = true,
+            },
           },
         },
           },
         },
-      },
-      format = {
-        formatting_options = nil,
-        timeout_ms = nil,
-      },
-      -- Automatically format on save
-      -- autoformat = false,
-      -- LSP Server Settings
-      ---@type lspconfig.options
-      servers = {
-        lua_ls = {
-          settings = {
-            Lua = {
-              workspace = { checkThirdParty = false, },
-              codeLens = { enable = true, },
-              completion = { callSnippet = "Replace", },
-              doc = { privateName = { "^_" }, },
-              hint = {
-                enable = true,
-                setType = false,
-                paramType = true,
-                paramName = "Disable",
-                semicolon = "Disable",
-                arrayIndex = "Disable",
-              },
-              diagnostics = {
-                disable = { "missing-fields", },
+        format = {
+          formatting_options = nil,
+          timeout_ms = nil,
+        },
+        -- Automatically format on save
+        -- autoformat = false,
+        -- LSP Server Settings
+        ---@type lspconfig.options
+        servers = {
+          lua_ls = {
+            settings = {
+              Lua = {
+                workspace = { checkThirdParty = false, },
+                codeLens = { enable = true, },
+                completion = { callSnippet = "Replace", },
+                doc = { privateName = { "^_" }, },
+                hint = {
+                  enable = true,
+                  setType = false,
+                  paramType = true,
+                  paramName = "Disable",
+                  semicolon = "Disable",
+                  arrayIndex = "Disable",
+                },
+                diagnostics = {
+                  disable = { "missing-fields", },
+                },
               },
             },
           },
               },
             },
           },
+          -- Add clangd extensions
+          -- https://github.com/p00f/clangd_extensions.nvim
         },
         },
-        -- Add clangd extensions
-        -- https://github.com/p00f/clangd_extensions.nvim
-      },
-      -- you can do any additional lsp server setup here
-      -- return true if you don't want this server to be setup with lspconfig
-      ---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
-      setup = {
-        -- example to setup with typescript.nvim
-        -- tsserver = function(_, opts)
-        --   require("typescript").setup({ server = opts })
-        --   return true
-        -- end,
-        -- Specify * to use this function as a fallback for any server
-        -- ["*"] = function(server, opts) end,
-      },
-    },
+        -- you can do any additional lsp server setup here
+        -- return true if you don't want this server to be setup with lspconfig
+        ---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
+        setup = {
+          -- example to setup with typescript.nvim
+          -- tsserver = function(_, opts)
+          --   require("typescript").setup({ server = opts })
+          --   return true
+          -- end,
+          -- Specify * to use this function as a fallback for any server
+          -- ["*"] = function(server, opts) end,
+        },
+      }
+    end,
   },
 
   -- cmdline tools and lsp servers
   },
 
   -- cmdline tools and lsp servers