From b655d82f15bd0da13dad89a8c02f546446c7fea9 Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Thu, 11 May 2023 19:53:49 +0100 Subject: [PATCH] added lsp_signature --- lua/andr3/lsp.lua | 44 +++++++++++++++++++++-- lua/andr3/packer.lua | 1 + plugin/packer_compiled.lua | 71 ++++++++++++++++++++------------------ 3 files changed, 80 insertions(+), 36 deletions(-) diff --git a/lua/andr3/lsp.lua b/lua/andr3/lsp.lua index 973bfc3..cfafc9e 100644 --- a/lua/andr3/lsp.lua +++ b/lua/andr3/lsp.lua @@ -1,7 +1,11 @@ require 'andr3.lsp_adds.prettier' require 'andr3.lsp_adds.null-ls' --- Items +-- Signature + +require 'lsp_signature'.setup({ }); + +-- Items {{{ require('vim.lsp.protocol').CompletionItemKind = { '', -- Text '', -- Method @@ -29,8 +33,34 @@ require('vim.lsp.protocol').CompletionItemKind = { '', -- Operator '', -- TypeParameter } +--- }}} -vim.diagnostic.config({ virtual_text = { prefix = '🅰', } }) +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + -- Enable underline, use default values + underline = true, + -- Enable virtual text, override spacing to 4 + virtual_text = { + spacing = 4, + prefix = '~', + }, + -- Use a function to dynamically turn signs off + -- and on, using buffer local variables + signs = function(bufnr, client_id) + local ok, result = pcall(vim.api.nvim_buf_get_var, bufnr, 'show_signs') + -- No buffer local variable set, so just enable by default + if not ok then + return true + end + + return result + end, + -- Disable a feature + update_in_insert = false, + } +) + +-- vim.diagnostic.config({ virtual_text = { prefix = '🅰', } }) local warn = "😞"; local signs = { Error = "☣️ ", Warn = warn, Hint = "❤️ ", Info = "🆓" } @@ -151,8 +181,9 @@ keymap("n", "sf", "Lspsaga lsp_finder", { silent = true }) keymap({"n","v"}, "ca", function () saga.code_action() end, {}) keymap("n", "gr", "Lspsaga rename", { silent = true }) keymap("n", "gd", "Lspsaga peek_definition", { silent = true }) -keymap("n", "cd", "Lspsaga show_line_diagnostics", { silent = true }) +--keymap("n", "cd", "Lspsaga show_line_diagnostics", { silent = true }) keymap("n", "cd", "Lspsaga show_cursor_diagnostics", { silent = true }) +keymap('n', 'e', 'lua vim.diagnostic.open_float()', { silent = true }) keymap("n", "[e", "Lspsaga diagnostic_jump_prev", { silent = true }) keymap("n", "]e", "Lspsaga diagnostic_jump_next", { silent = true }) @@ -250,6 +281,13 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) + require "lsp_signature".on_attach({ + bind = true, + handler_opts = { + border = "rounded" + } + }, bufnr) + -- Enable completion triggered by vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') diff --git a/lua/andr3/packer.lua b/lua/andr3/packer.lua index 6f3d125..0299fe5 100644 --- a/lua/andr3/packer.lua +++ b/lua/andr3/packer.lua @@ -15,6 +15,7 @@ return require('packer').startup(function() -- other stuff use 'neovim/nvim-lspconfig' + use 'ray-x/lsp_signature.nvim' use 'jose-elias-alvarez/null-ls.nvim' diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index e47ed83..d11e6e5 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -49,8 +49,8 @@ local function save_profiles(threshold) end time([[Luarocks path setup]], true) -local package_path_str = "/Users/AHS40/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/AHS40/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/AHS40/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/AHS40/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/Users/AHS40/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +local package_path_str = "/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/andr3/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" if not string.find(package.path, package_path_str, 1, true) then package.path = package.path .. ';' .. package_path_str end @@ -76,157 +76,162 @@ time([[Defining packer_plugins]], true) _G.packer_plugins = { ["ayu-vim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/ayu-vim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/ayu-vim", url = "https://github.com/ayu-theme/ayu-vim" }, catppuccin = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/catppuccin", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/catppuccin", url = "https://github.com/catppuccin/nvim" }, ["cmp-buffer"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/cmp-buffer", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/cmp-buffer", url = "https://github.com/hrsh7th/cmp-buffer" }, ["cmp-cmdline"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/cmp-cmdline", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/cmp-cmdline", url = "https://github.com/hrsh7th/cmp-cmdline" }, ["cmp-nvim-lsp"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", url = "https://github.com/hrsh7th/cmp-nvim-lsp" }, ["cmp-path"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/cmp-path", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/cmp-path", url = "https://github.com/hrsh7th/cmp-path" }, ["eva01.vim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/eva01.vim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/eva01.vim", url = "https://github.com/hachy/eva01.vim" }, ["html5.vim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/html5.vim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/html5.vim", url = "https://github.com/othree/html5.vim" }, + ["lsp_signature.nvim"] = { + loaded = true, + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim", + url = "https://github.com/ray-x/lsp_signature.nvim" + }, ["lspkind.nvim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/lspkind.nvim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/lspkind.nvim", url = "https://github.com/onsails/lspkind.nvim" }, ["lspsaga.nvim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", url = "https://github.com/glepnir/lspsaga.nvim" }, ["night_owl_light.vim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/night_owl_light.vim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/night_owl_light.vim", url = "https://github.com/macguirerintoul/night_owl_light.vim" }, ["null-ls.nvim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/null-ls.nvim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/null-ls.nvim", url = "https://github.com/jose-elias-alvarez/null-ls.nvim" }, ["nvim-cmp"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/nvim-cmp", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-cmp", url = "https://github.com/hrsh7th/nvim-cmp" }, ["nvim-lspconfig"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, ["nvim-tree.lua"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", url = "https://github.com/nvim-tree/nvim-tree.lua" }, ["nvim-treesitter"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-treesitter", url = "https://github.com/nvim-treesitter/nvim-treesitter" }, ["nvim-web-devicons"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", url = "https://github.com/nvim-tree/nvim-web-devicons" }, ["packer.nvim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/packer.nvim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/packer.nvim", url = "https://github.com/wbthomason/packer.nvim" }, ["plenary.nvim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/plenary.nvim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, ["prettier.nvim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/prettier.nvim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/prettier.nvim", url = "https://github.com/MunifTanjim/prettier.nvim" }, ["telescope.nvim"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/telescope.nvim", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/telescope.nvim", url = "https://github.com/nvim-telescope/telescope.nvim" }, undotree = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/undotree", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/undotree", url = "https://github.com/mbbill/undotree" }, ["vim-airline"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/vim-airline", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-airline", url = "https://github.com/vim-airline/vim-airline" }, ["vim-airline-themes"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/vim-airline-themes", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-airline-themes", url = "https://github.com/vim-airline/vim-airline-themes" }, ["vim-commentary"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/vim-commentary", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-commentary", url = "https://github.com/chrisbra/vim-commentary" }, ["vim-cyberpunk"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/vim-cyberpunk", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-cyberpunk", url = "https://github.com/thedenisnikulin/vim-cyberpunk" }, ["vim-gitgutter"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/vim-gitgutter", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-gitgutter", url = "https://github.com/airblade/vim-gitgutter" }, ["vim-javascript"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/vim-javascript", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-javascript", url = "https://github.com/pangloss/vim-javascript" }, ["vim-svelte"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/vim-svelte", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-svelte", url = "https://github.com/evanleck/vim-svelte" }, ["vim-visual-multi"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/vim-visual-multi", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-visual-multi", url = "https://github.com/mg979/vim-visual-multi" }, ["vim-vsnip"] = { loaded = true, - path = "/Users/AHS40/.local/share/nvim/site/pack/packer/start/vim-vsnip", + path = "/home/andr3/.local/share/nvim/site/pack/packer/start/vim-vsnip", url = "https://github.com/hrsh7th/vim-vsnip" } }