From 7b01e6a34392a27ccd0b2822fe74dbfe39a3c814 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Wed, 29 May 2024 11:51:07 -0400 Subject: [PATCH] feat(lsp): add `lspsaga.nvim` --- lua/astrocommunity/lsp/lspsaga-nvim/README.md | 5 ++ lua/astrocommunity/lsp/lspsaga-nvim/init.lua | 64 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 lua/astrocommunity/lsp/lspsaga-nvim/README.md create mode 100644 lua/astrocommunity/lsp/lspsaga-nvim/init.lua diff --git a/lua/astrocommunity/lsp/lspsaga-nvim/README.md b/lua/astrocommunity/lsp/lspsaga-nvim/README.md new file mode 100644 index 000000000..46a7f4dbf --- /dev/null +++ b/lua/astrocommunity/lsp/lspsaga-nvim/README.md @@ -0,0 +1,5 @@ +# lspsaga.nvim + +improve neovim lsp experience + +**Repository:** diff --git a/lua/astrocommunity/lsp/lspsaga-nvim/init.lua b/lua/astrocommunity/lsp/lspsaga-nvim/init.lua new file mode 100644 index 000000000..81526d276 --- /dev/null +++ b/lua/astrocommunity/lsp/lspsaga-nvim/init.lua @@ -0,0 +1,64 @@ +return { + "nvimdev/lspsaga.nvim", + event = "LspAttach", + cmd = "Lspsaga", + dependencies = { + "nvim-treesitter/nvim-treesitter", + { + "AstroNvim/astrocore", + opts = function(_, opts) + local maps = opts.mappings + maps.n["]d"] = { "Lspsaga diagnostic_jump_next", desc = "Next diagnostic" } + maps.n["[d"] = { "Lspsaga diagnostic_jump_prev", desc = "Previous diagnostic" } + end, + }, + { + "AstroNvim/astrolsp", + opts = function(_, opts) + local maps = opts.mappings + maps.n["K"] = { "Lspsaga hover_doc", desc = "Hover symbol details", cond = "textDocument/hover" } + + -- call hierarchy + maps.n["lc"] = + { "Lspsaga incoming_calls", desc = "Incoming calls", cond = "callHierarchy/incomingCalls" } + maps.n["lC"] = + { "Lspsaga outgoing_calls", desc = "Outgoing calls", cond = "callHierarchy/outgoingCalls" } + + -- code action + maps.n["la"] = + { "Lspsaga code_action", desc = "LSP code action", cond = "textDocument/codeAction" } + maps.x["la"] = + { ":Lspsaga code_action", desc = "LSP code action", cond = "textDocument/codeAction" } + + -- definition + maps.n["lp"] = + { "Lspsaga peek_definition", desc = "Peek definition", cond = "textDocument/definition" } + + -- outline + maps.n["lS"] = + { "Lspsaga outline", desc = "Symbols outline", cond = "textDocument/documentSymbol" } + + -- references + maps.n["lR"] = { + "Lspsaga finder", + desc = "Search references", + cond = function(client) + return client.supports_method "textDocument/references" + or client.supports_method "textDocument/implementation" + end, + } + + -- rename + maps.n["lr"] = + { "Lspsaga rename", desc = "Rename current symbol", cond = "textDocument/rename" } + end, + }, + }, + opts = function() + return { + code_action = { extend_gitsigns = require("astrocore").is_available "gitsigns.nvim" }, + lightbulb = { sign = false }, + ui = { code_action = require("astroui").get_icon("DiagnosticHint", 0, true) }, + } + end, +}