Skip to content

Commit

Permalink
feat(lspsaga): support v0.3 (ayamir#857)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jint-lzxy authored and singlemancombat committed Jul 12, 2023
1 parent 2db33de commit 1a2b9a4
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 43 deletions.
4 changes: 2 additions & 2 deletions lua/keymap/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function mapping.lsp(buf)
["n|go"] = map_cr("Lspsaga outline"):with_buffer(buf):with_desc("lsp: Toggle outline"),
["n|gjp"] = map_cr("Lspsaga diagnostic_jump_prev"):with_buffer(buf):with_desc("lsp: Prev diagnostic"),
["n|gjn"] = map_cr("Lspsaga diagnostic_jump_next"):with_buffer(buf):with_desc("lsp: Next diagnostic"),
["n|gsl"] = map_cr("Lspsaga show_line_diagnostics"):with_buffer(buf):with_desc("lsp: Line diagnostic"),
["n|gsl"] = map_cr("Lspsaga show_line_diagnostics ++unfocus"):with_buffer(buf):with_desc("lsp: Line diagnostic"),
["n|gsc"] = map_cr("Lspsaga show_cursor_diagnostics"):with_buffer(buf):with_desc("lsp: Cursor diagnostic"),
["n|gsb"] = map_cr("Lspsaga show_buf_diagnostics"):with_buffer(buf):with_desc("lsp: Buffer diagnostic"),
["n|gr"] = map_cr("Lspsaga rename"):with_buffer(buf):with_desc("lsp: Rename in file range"),
Expand All @@ -29,7 +29,7 @@ function mapping.lsp(buf)
["n|gD"] = map_cr("Lspsaga goto_definition"):with_buffer(buf):with_desc("lsp: Goto definition"),
["n|gp"] = map_cr("Lspsaga preview_definition"):with_buffer(buf):with_desc("lsp: Preview definition"),
["n|gt"] = map_cr("Lspsaga term_toggle"):with_buffer(buf):with_desc("lsp: Toggle term"),
["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|gci"] = map_cr("Lspsaga incoming_calls"):with_buffer(buf):with_desc("lsp: Show incoming calls"),
["n|gco"] = 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

0 comments on commit 1a2b9a4

Please sign in to comment.