diff options
author | Toby Vincent <tobyv13@gmail.com> | 2023-05-29 16:58:20 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2023-05-29 16:58:20 -0500 |
commit | fd1b9d18c5a77d55e6a84e9684571904d0956d7d (patch) | |
tree | 04d244d5e4dab3804794436d4b62e21036b513b5 /nvim/.config | |
parent | a1ec9dd7abd8eb72b457d1a675b015bf65dce3f4 (diff) |
feat(nvim): refresh lsp codelens on lsp attach
Diffstat (limited to 'nvim/.config')
-rw-r--r-- | nvim/.config/nvim/lua/tobyvin/lsp.lua | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/nvim/.config/nvim/lua/tobyvin/lsp.lua b/nvim/.config/nvim/lua/tobyvin/lsp.lua index 159a850..3dbe969 100644 --- a/nvim/.config/nvim/lua/tobyvin/lsp.lua +++ b/nvim/.config/nvim/lua/tobyvin/lsp.lua @@ -1,4 +1,4 @@ -local augroup = vim.api.nvim_create_augroup("lsp", {}) +local augroup = vim.api.nvim_create_augroup("lsp", { clear = true }) for method, handler in pairs(require("tobyvin.lsp.handlers")) do vim.lsp.handlers[method] = handler @@ -15,7 +15,7 @@ vim.api.nvim_create_autocmd("LspAttach", { group = augroup, buffer = args.buf, callback = vim.lsp.buf.document_highlight, - desc = "document highlight", + desc = "highlight references", }) vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { @@ -26,7 +26,17 @@ vim.api.nvim_create_autocmd("LspAttach", { }) end - if vim.tbl_get(client.server_capabilities, "experimental", "externalDocs") then + if client.server_capabilities.codeLensProvider then + vim.lsp.codelens.refresh() + vim.api.nvim_create_autocmd({ "TextChanged", "InsertLeave" }, { + group = augroup, + buffer = args.buf, + callback = vim.lsp.codelens.refresh, + desc = "refresh codelens", + }) + end + + if (client.server_capabilities.experimental or {}).externalDocs then vim.keymap.set("n", "gx", vim.lsp.buf.external_docs, { desc = "external_docs", buffer = args.buf }) end |