From 85ffa0c0ef528247c72fe7a8cc3fdc2ac3468894 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 28 Jul 2024 22:59:05 +0200 Subject: [PATCH] Use builtin signature helper (and prepare for builtin cmp) --- modules/cli/nvim/lua/plugins/lsp.lua | 29 ++++++++-------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/modules/cli/nvim/lua/plugins/lsp.lua b/modules/cli/nvim/lua/plugins/lsp.lua index 1e64d1a..bdc1ffa 100644 --- a/modules/cli/nvim/lua/plugins/lsp.lua +++ b/modules/cli/nvim/lua/plugins/lsp.lua @@ -3,7 +3,9 @@ local lsp_keymaps = function(buffer) vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) end - map("n", "", 'lua vim.lsp.buf.signature_help()', "See signature help") + + map("i", "", 'lua vim.lsp.completion.trigger()', "Open completion menu") + map({ "n", "i" }, "", 'lua vim.lsp.buf.signature_help()', "See signature help") map("n", "gD", 'lua vim.lsp.buf.declaration()', "Go to declaration") map("n", "gd", 'lua vim.lsp.buf.definition()', "Go to definition") @@ -26,14 +28,12 @@ return { event = { "BufReadPost", "BufWritePost", "BufNewFile" }, dependencies = { "neovim/nvim-lspconfig", - "cmp-nvim-lsp", }, opts = function() - local lsp_on_attach = function(_, buffer) + local lsp_on_attach = function(client, buffer) lsp_keymaps(buffer) + vim.lsp.completion.enable(true, client.id, buffer) end - local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities() - local lspconfig = require("lspconfig") return { @@ -76,7 +76,6 @@ return { default_config = { on_attach = lsp_on_attach, - capabilities = lsp_capabilities, }, configs = { jsonls = { @@ -183,7 +182,6 @@ return { } end, init = function() - vim.keymap.set("n", "gl", "lua vim.diagnostic.open_float()", { desc = "See diagnostics" }) vim.keymap.set("n", "li", "LspInfo", { desc = "Info" }) vim.diagnostic.config({ @@ -205,6 +203,9 @@ return { vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded", }) + vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = 'rounded', + }) end, }, @@ -242,20 +243,6 @@ return { }, }, - { - "ray-x/lsp_signature.nvim", - event = "VeryLazy", - opts = { - doc_lines = 100, - fix_pos = true, - always_trigger = true, - select_signature_key = "", - toggle_key = "", - toggle_key_flip_floatwin_setting = true, - floating_window = false, - } - }, - { "stevearc/conform.nvim", cmd = "ConformInfo",