diff --git a/lua/lspsaga/codeaction/init.lua b/lua/lspsaga/codeaction/init.lua index cbd4f0eee..9a07f52a7 100644 --- a/lua/lspsaga/codeaction/init.lua +++ b/lua/lspsaga/codeaction/init.lua @@ -86,6 +86,8 @@ function act:action_callback(tuples, enriched_ctx) :winopt({ ['conceallevel'] = 2, ['concealcursor'] = 'niv', + ['cursorline'] = config.code_action.cursorline, + ['cursorlineopt'] = 'both', }) :winhl('SagaNormal', 'SagaBorder') :wininfo() @@ -100,6 +102,7 @@ function act:action_callback(tuples, enriched_ctx) end, }) + vim.opt.winhl:append('CursorLine:CodeActionCursorLine') for i = 1, #content, 1 do local row = i - 1 local col = content[i]:find('%]') diff --git a/lua/lspsaga/codeaction/preview.lua b/lua/lspsaga/codeaction/preview.lua index edf20cec6..a72f4ba8c 100644 --- a/lua/lspsaga/codeaction/preview.lua +++ b/lua/lspsaga/codeaction/preview.lua @@ -111,11 +111,12 @@ local function create_preview_win(content, main_winid) end local winheight = api.nvim_win_get_height(win_conf.win) + local win_margin = config.ui.border == 'none' and 0 or 2 if win_conf.anchor:find('^S') then - opt.row = util.is_ten and win_conf.row - 3 or win_conf.row[false] - win_conf.height - 2 + opt.row = util.is_ten and win_conf.row - 3 or win_conf.row[false] - win_conf.height - win_margin max_height = util.is_ten and win_conf.row or win_conf.row[false] - win_conf.height elseif win_conf.anchor:find('^N') then - opt.row = util.is_ten and win_conf.row + 3 or win_conf.row[false] + win_conf.height + 2 + opt.row = util.is_ten and win_conf.row + 3 or win_conf.row[false] + win_conf.height + win_margin max_height = winheight - opt.row end diff --git a/lua/lspsaga/highlight.lua b/lua/lspsaga/highlight.lua index 18a9e3946..084d9a852 100644 --- a/lua/lspsaga/highlight.lua +++ b/lua/lspsaga/highlight.lua @@ -28,6 +28,7 @@ local function hi_define() ActionPreviewTitle = { link = 'Title' }, CodeActionText = { link = '@variable' }, CodeActionNumber = { link = 'DiffAdd' }, + CodeActionCursorLine = { link = 'CursorLine' }, -- hover HoverNormal = { link = 'SagaNormal' }, HoverBorder = { link = 'SagaBorder' }, diff --git a/lua/lspsaga/init.lua b/lua/lspsaga/init.lua index 93c4b78d1..f60440c87 100644 --- a/lua/lspsaga/init.lua +++ b/lua/lspsaga/init.lua @@ -49,6 +49,7 @@ local default_config = { extend_gitsigns = false, only_in_cursor = true, max_height = 0.3, + cursorline = true, keys = { quit = 'q', exec = '',