This commit is contained in:
Michael Chalupiak 2024-12-03 23:12:06 -05:00
parent 731d8dac06
commit 86d8fa773c

View File

@ -29,6 +29,8 @@ lsp_config.nim_langserver.setup{
lsp_config.hls.setup{} lsp_config.hls.setup{}
lsp_config.clojure_lsp.setup{}
local cmp = require("cmp") local cmp = require("cmp")
local cmp_select = {behavior = cmp.SelectBehavior.Select} local cmp_select = {behavior = cmp.SelectBehavior.Select}
local cmp_mappings = lsp.defaults.cmp_mappings({ local cmp_mappings = lsp.defaults.cmp_mappings({
@ -40,7 +42,7 @@ local cmp_mappings = lsp.defaults.cmp_mappings({
cmp.setup { cmp.setup {
sources = { sources = {
-- { name = 'conjure' }, { name = 'conjure' },
{ name = 'nvim_lsp_signature_help' }, { name = 'nvim_lsp_signature_help' },
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
@ -55,6 +57,12 @@ lsp.setup_nvim_cmp({
mapping = cmp_mappings mapping = cmp_mappings
}) })
vim.api.nvim_create_autocmd('User', {
pattern = 'LspAttached',
once = true,
callback = vim.lsp.codelens.refresh,
})
lsp.on_attach(function(client, bufnr) lsp.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false} local opts = {buffer = bufnr, remap = false}
@ -66,6 +74,14 @@ lsp.on_attach(function(client, bufnr)
capabilities = capabilities capabilities = capabilities
end 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", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts) vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)