feat(lsp): add snippet support and refactor completion into Item class

This commit is contained in:
2026-04-17 00:03:03 +02:00
parent 5ecec7cc6c
commit 47f36adc21
9 changed files with 213 additions and 144 deletions
+13
View File
@@ -162,6 +162,18 @@ end)
vim.keymap.set({ "i", "s" }, "<C-s>", function()
vim.lsp.buf.signature_help({ max_width = 80 })
end)
---@param key string
---@param dir 1 | -1
local function snippet_jump_map(key, dir)
vim.keymap.set({ "i", "s" }, key, function()
if vim.snippet.active({ direction = dir }) then
return string.format("<cmd>lua vim.snippet.jump(%d)<CR>", dir)
end
return key
end, { expr = true, replace_keycodes = true })
end
snippet_jump_map("<Tab>", 1)
snippet_jump_map("<S-Tab>", -1)
vim.keymap.set({ "n", "i" }, "<C-h>", vim.lsp.buf.document_highlight)
vim.keymap.set({ "n", "x" }, "<leader>lf", vim.lsp.buf.format)
vim.keymap.set("n", "grl", function()
@@ -177,6 +189,7 @@ vim.keymap.set({ "n", "i" }, "<C-l>", function()
vim.lsp.buf.clear_references()
vim.cmd.nohlsearch()
vim.schedule(vim.cmd.diffupdate)
vim.snippet.stop()
return "<C-l>"
end, { expr = true })
vim.keymap.set("n", "<leader>fd", vim.diagnostic.setloclist)