From 86d8fa773c3fc4bde29a7687e230bceaa78bb28e Mon Sep 17 00:00:00 2001 From: Michael Chalupiak Date: Tue, 3 Dec 2024 23:12:06 -0500 Subject: [PATCH] codelens --- config/.config/nvim/after/plugin/lsp.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/config/.config/nvim/after/plugin/lsp.lua b/config/.config/nvim/after/plugin/lsp.lua index 885ea7d..ebeb313 100755 --- a/config/.config/nvim/after/plugin/lsp.lua +++ b/config/.config/nvim/after/plugin/lsp.lua @@ -29,6 +29,8 @@ lsp_config.nim_langserver.setup{ lsp_config.hls.setup{} +lsp_config.clojure_lsp.setup{} + local cmp = require("cmp") local cmp_select = {behavior = cmp.SelectBehavior.Select} local cmp_mappings = lsp.defaults.cmp_mappings({ @@ -40,7 +42,7 @@ local cmp_mappings = lsp.defaults.cmp_mappings({ cmp.setup { sources = { - -- { name = 'conjure' }, + { name = 'conjure' }, { name = 'nvim_lsp_signature_help' }, { name = 'nvim_lsp' }, { name = 'luasnip' }, @@ -55,6 +57,12 @@ lsp.setup_nvim_cmp({ mapping = cmp_mappings }) +vim.api.nvim_create_autocmd('User', { + pattern = 'LspAttached', + once = true, + callback = vim.lsp.codelens.refresh, +}) + lsp.on_attach(function(client, bufnr) local opts = {buffer = bufnr, remap = false} @@ -66,6 +74,14 @@ lsp.on_attach(function(client, bufnr) capabilities = capabilities end + vim.api.nvim_create_autocmd({ 'TextChanged', 'InsertLeave' }, { + buffer = bufnr, + callback = vim.lsp.codelens.refresh, + }) + -- trigger codelens refresh + vim.api.nvim_exec_autocmds('User', { pattern = 'LspAttached' }) + + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) vim.keymap.set("n", "vws", vim.lsp.buf.workspace_symbol, opts)