Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lsp): add lspsaga.nvim #1005

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lua/astrocommunity/lsp/lspsaga-nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# lspsaga.nvim

improve neovim lsp experience

**Repository:** <https://github.com/nvimdev/lspsaga.nvim>
64 changes: 64 additions & 0 deletions lua/astrocommunity/lsp/lspsaga-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -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"] = { "<Cmd>Lspsaga diagnostic_jump_next<CR>", desc = "Next diagnostic" }
maps.n["[d"] = { "<Cmd>Lspsaga diagnostic_jump_prev<CR>", desc = "Previous diagnostic" }
end,
},
{
"AstroNvim/astrolsp",
opts = function(_, opts)
local maps = opts.mappings
maps.n["K"] = { "<Cmd>Lspsaga hover_doc<CR>", desc = "Hover symbol details", cond = "textDocument/hover" }

-- call hierarchy
maps.n["<Leader>lc"] =
{ "<Cmd>Lspsaga incoming_calls<CR>", desc = "Incoming calls", cond = "callHierarchy/incomingCalls" }
maps.n["<Leader>lC"] =
{ "<Cmd>Lspsaga outgoing_calls<CR>", desc = "Outgoing calls", cond = "callHierarchy/outgoingCalls" }

-- code action
maps.n["<Leader>la"] =
{ "<Cmd>Lspsaga code_action<CR>", desc = "LSP code action", cond = "textDocument/codeAction" }
maps.x["<Leader>la"] =
{ ":<C-U>Lspsaga code_action<CR>", desc = "LSP code action", cond = "textDocument/codeAction" }

-- definition
maps.n["<Leader>lp"] =
{ "<Cmd>Lspsaga peek_definition<CR>", desc = "Peek definition", cond = "textDocument/definition" }

-- outline
maps.n["<Leader>lS"] =
{ "<Cmd>Lspsaga outline<CR>", desc = "Symbols outline", cond = "textDocument/documentSymbol" }

-- references
maps.n["<Leader>lR"] = {
"<Cmd>Lspsaga finder<CR>",
desc = "Search references",
cond = function(client)
return client.supports_method "textDocument/references"
or client.supports_method "textDocument/implementation"
end,
}

-- rename
maps.n["<Leader>lr"] =
{ "<Cmd>Lspsaga rename<CR>", 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,
}
Loading