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(lspsaga): support v0.3 #857

Merged
merged 3 commits into from
Jul 12, 2023
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
6 changes: 4 additions & 2 deletions lua/keymap/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ function mapping.lsp(buf)
["n|go"] = map_cr("Lspsaga outline"):with_buffer(buf):with_desc("lsp: Toggle outline"),
["n|g["] = map_cr("Lspsaga diagnostic_jump_prev"):with_buffer(buf):with_desc("lsp: Prev diagnostic"),
["n|g]"] = map_cr("Lspsaga diagnostic_jump_next"):with_buffer(buf):with_desc("lsp: Next diagnostic"),
["n|<leader>ld"] = map_cr("Lspsaga show_line_diagnostics"):with_buffer(buf):with_desc("lsp: Line diagnostic"),
["n|<leader>ld"] = map_cr("Lspsaga show_line_diagnostics ++unfocus")
:with_buffer(buf)
:with_desc("lsp: Line diagnostic"),
["n|gs"] = map_callback(function()
vim.lsp.buf.signature_help()
end):with_desc("lsp: Signature help"),
Expand All @@ -28,7 +30,7 @@ function mapping.lsp(buf)
["nv|ga"] = map_cr("Lspsaga code_action"):with_buffer(buf):with_desc("lsp: Code action for cursor"),
["n|gd"] = map_cr("Lspsaga peek_definition"):with_buffer(buf):with_desc("lsp: Preview definition"),
["n|gD"] = map_cr("Lspsaga goto_definition"):with_buffer(buf):with_desc("lsp: Goto definition"),
["n|gh"] = map_cr("Lspsaga lsp_finder"):with_buffer(buf):with_desc("lsp: Show reference"),
["n|gh"] = map_cr("Lspsaga finder"):with_buffer(buf):with_desc("lsp: Show reference"),
["n|<leader>ci"] = map_cr("Lspsaga incoming_calls"):with_buffer(buf):with_desc("lsp: Show incoming calls"),
["n|<leader>co"] = map_cr("Lspsaga outgoing_calls"):with_buffer(buf):with_desc("lsp: Show outgoing calls"),
}
Expand Down
93 changes: 61 additions & 32 deletions lua/modules/configs/completion/lspsaga.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,42 @@ return function()
set_sidebar_icons()

require("lspsaga").setup({
preview = {
lines_above = 1,
lines_below = 17,
},
scroll_preview = {
scroll_down = "<C-j>",
scroll_up = "<C-k>",
},
request_timeout = 3000,
finder = {
silent = true,
default = "def+ref+imp",
layout = "float",
filter = {},
keys = {
shuttle = "[]",
toggle_or_open = "<CR>",
jump_to = "e",
expand_or_jump = "<CR>",
vsplit = "s",
split = "i",
vsplit = "v",
split = "s",
tabe = "t",
quit = { "q", "<ESC>" },
close_in_preview = "<ESC>",
tabnew = "n",
quit = "q",
close = "<Esc>",
},
},
definition = {
edit = "<C-c>o",
vsplit = "<C-c>v",
split = "<C-c>s",
tabe = "<C-c>t",
quit = "q",
keys = {
edit = "<C-c>o",
vsplit = "<C-c>v",
split = "<C-c>s",
tabe = "<C-c>t",
close = "<C-c>q",
quit = "q",
},
},
code_action = {
num_shortcut = true,
show_server_name = true,
extend_gitsigns = false,
keys = {
quit = "q",
exec = "<CR>",
Expand All @@ -63,71 +70,93 @@ return function()
lightbulb = {
enable = false,
sign = true,
enable_in_insert = true,
sign_priority = 20,
virtual_text = false,
},
diagnostic = {
max_width = 0.5,
max_height = 0.6,
text_hl_follow = true,
on_insert = true,
on_insert_follow = false,
show_code_action = true,
show_source = true,
border_follow = true,
diagnostic_only_current = false,
extend_relatedInformation = false,
jump_num_shortcut = true,
show_layout = "float",
keys = {
exec_action = "r",
quit = "q",
expand_or_jump = "<CR>",
quit_in_show = { "q", "<ESC>" },
toggle_or_jump = "<CR>",
quit_in_show = { "q", "<Esc>" },
},
},
rename = {
quit = "<C-c>",
mark = "x",
confirm = "<CR>",
exec = "<CR>",
in_select = true,
in_select = false,
auto_save = false,
keys = {
quit = "<Esc>",
select = "x",
exec = "<CR>",
},
},
hover = {
max_width = 0.3,
max_height = 0.7,
open_link = "gl",
open_browser = "silent !" .. require("core.settings").external_browser,
},
outline = {
win_position = "right",
win_with = "_sagaoutline",
win_width = 30,
auto_preview = false,
auto_refresh = true,
auto_close = true,
close_after_jump = true,
detail = false,
layout = "normal",
keys = {
expand_or_jump = "<CR>",
toggle_or_jump = "<CR>",
jump = "o",
quit = "q",
},
},
symbol_in_winbar = {
enable = true,
separator = " " .. icons.ui.Separator,
hide_keyword = true,
hide_keyword = false,
show_file = false,
color_mode = true,
},
implement = {
enable = true,
sign = true,
virtual_text = false,
},
callhierarchy = {
layout = "float",
keys = {
edit = "e",
vsplit = "v",
split = "s",
tabe = "t",
quit = "q",
shuttle = "[]",
toggle_or_req = "u",
close = "<Esc>",
},
},
beacon = {
enable = true,
frequency = 12,
},
ui = {
title = false,
devicon = true,
border = "single", -- Can be single, double, rounded, solid, shadow.
winblend = 0,
actionfix = icons.ui.Spell,
expand = icons.ui.ArrowClosed,
collapse = icons.ui.ArrowOpen,
code_action = icons.ui.CodeAction,
incoming = icons.ui.Incoming,
outgoing = icons.ui.Outgoing,
imp_sign = icons.kind.Implementation,
kind = {
-- Kind
Class = { icons.kind.Class, "LspKindClass" },
Expand Down
2 changes: 1 addition & 1 deletion lua/modules/configs/editor/better-escape.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ return function()
keys = "<Esc>", -- keys used for escaping, if it is a function will use the result everytime
-- example(recommended)
-- keys = function()
-- return vim.api.nvim_win_get_cursor(0)[2] > 1 and '<esc>l' or '<esc>'
-- return vim.api.nvim_win_get_cursor(0)[2] > 1 and '<Esc>l' or '<Esc>'
-- end,
})
end
2 changes: 1 addition & 1 deletion lua/modules/configs/tool/trouble.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ return function()
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<ESC>", -- cancel the preview and get back to your last window / buffer / cursor
cancel = "<Esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<CR>", "<TAB>" }, -- jump to the diagnostic or open / close folds
open_split = { "<C-x>" }, -- open buffer in new split
Expand Down
7 changes: 0 additions & 7 deletions lua/modules/configs/ui/catppuccin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,6 @@ return function()
bg = transparent_background and cp.none or cp.mantle,
},

-- For lspsaga.nvim
OutlineNormal = { bg = transparent_background and cp.none or cp.mantle },
OutlineWinSeparator = {
bg = transparent_background and cp.none or cp.base,
fg = transparent_background and cp.surface1 or cp.base,
},

-- For fidget
FidgetTask = { bg = cp.none, fg = cp.surface2 },
FidgetTitle = { fg = cp.blue, style = { "bold" } },
Expand Down
1 change: 1 addition & 0 deletions lua/modules/utils/icons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local data = {
Folder = "󰉋",
Function = "󰊕",
Interface = "",
Implementation = "",
Keyword = "󰌋",
Method = "󰆧",
Module = "",
Expand Down