Selaa lähdekoodia

remove coc, add inital codelense setup and commented out insertLeave formatting

Noah Vogt 21 tuntia sitten
vanhempi
sitoutus
49338e95d6
3 muutettua tiedostoa jossa 24 lisäystä ja 58 poistoa
  1. 0 57
      dot-config/nvim/coc-settings.json
  2. 3 0
      dot-config/nvim/lua/keymaps.lua
  3. 21 1
      dot-config/nvim/lua/lsp.lua

+ 0 - 57
dot-config/nvim/coc-settings.json

@@ -1,57 +0,0 @@
-{
-   "semanticTokens.enable": true,
-   "codeLens.enable": true,
-   "codeLens.position": "eol",
-   "coc.preferences.formatOnType": true,
-   "coc.preferences.enableMessageDialog": true,
-   "python.formatting.provider": "black",
-   "python.formatting.blackPath": "/usr/bin/black",
-   "coc.preferences.formatOnSaveFiletypes": ["python", "java", "verilog"],
-
-
-  "diagnostic-languageserver.filetypes": {
-    "sh": "shellcheck"
-  },
-  "diagnostic-languageserver.formatFiletypes": {
-    "sh": "shfmt",
-    "python": "black"
-  },
-  "python.linting.pylintEnabled": true,
-  "languageserver": {
-    "veridian": {
-      "command": "veridian",
-      "filetypes": ["systemverilog", "verilog"]
-    },
-    "ccls": {
-      "command": "ccls",
-      "filetypes": [
-        "c",
-        "cpp",
-        "cuda",
-        "objc",
-        "objcpp"
-      ],
-      "rootPatterns": [
-        ".ccls-root",
-        "compile_commands.json"
-      ],
-      "initializationOptions": {
-        "cache": {
-          "directory": "/tmp/ccls-cache"
-        },
-        "client": {
-          "snippetSupport": true
-        }
-      }
-    }
-  },
-  //"codeLens.enable": true,
-  //"java.referencesCodeLens.enabled": true,
-  // "java.jdt.ls.vmargs": "-javaagent:/usr/local/share/lombok/lombok.jar",
-  "snippets.userSnippetsDirectory": "~/.config/nvim/snips",
-  "suggest.noselect": true,
-  "java.format.settings.url": "/home/based/.config/coc/extensions/node_modules/redhat.java/",
-  "coc.source.vimtex.filetypes": [
-    "tex"
-  ]
-}

+ 3 - 0
dot-config/nvim/lua/keymaps.lua

@@ -49,6 +49,9 @@ keymap("n", "<leader>rn", vim.lsp.buf.rename, opts)
 -- LSP code actions
 keymap({ "n", "x" }, "<leader>a", vim.lsp.buf.code_action, opts)
 
+-- LSP CodeLens
+keymap("n", "<leader>cl", vim.lsp.codelens.run, opts)
+
 -- Switch to last opened file
 keymap("n", "<leader>b", "<c-^><cr>")
 

+ 21 - 1
dot-config/nvim/lua/lsp.lua

@@ -29,7 +29,27 @@ require("luasnip.loaders.from_snipmate").lazy_load({ paths = { "~/.config/nvim/s
 
 -- 2. Define on_attach
 local on_attach = function(client, bufnr)
-  -- Keymaps are handled globally in bindings.vim
+  -- Keymaps are handled globally in keymaps.lua (formerly bindings.vim)
+
+  -- Enable CodeLens if supported
+  if client.supports_method("textDocument/codeLens") then
+    vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, {
+      buffer = bufnr,
+      callback = function()
+        vim.lsp.codelens.refresh({ bufnr = bufnr })
+      end,
+    })
+  end
+
+  -- Format on Type (Commented out - prefer Format on Save in conform.nvim)
+  -- if client.supports_method("textDocument/onTypeFormatting") then
+  --   vim.api.nvim_create_autocmd("InsertLeave", {
+  --     buffer = bufnr,
+  --     callback = function()
+  --       vim.lsp.buf.format({ bufnr = bufnr, async = true })
+  --     end,
+  --   })
+  -- end
 end
 
 -- 3. Configure Servers using Neovim 0.11 API where possible