issue #246 code action ui width

pull/249/head
ray-x 1 year ago
parent 926dc63fa4
commit c0bfecc6af

@ -13,7 +13,7 @@ end
_NgConfigValues = {
debug = false, -- log output
width = 0.62, -- valeu of cols
width = 0.75, -- value of cols
height = 0.38, -- listview height
preview_height = 0.38,
preview_lines = 40, -- total lines in preview screen
@ -45,6 +45,7 @@ _NgConfigValues = {
lsp = {
enable = true, -- if disabled make sure add require('navigator.lspclient.mapping').setup() in you on_attach
code_action = {
delay = 3000, -- how long the virtual text will be shown
enable = true,
sign = true,
sign_priority = 40,

@ -121,6 +121,16 @@ function code_action:render_action_virtual_text(line, diagnostics)
_update_virtual_text(line, actions)
end
end
vim.defer_fn(function()
log('clear vt')
if config.lsp.code_action.virtual_text then
_update_virtual_text(nil)
end
if config.lsp.code_action.sign then
_update_sign(nil)
end
end, _NgConfigValues.lsp.code_action.delay)
end
end
@ -133,9 +143,6 @@ local special_buffers = {
['markdown'] = true,
['text'] = true,
}
-- local action_call_back = function (_,_)
-- return Action:action_callback()
-- end
local action_virtual_call_back = function(line, diagnostics)
return code_action:render_action_virtual_text(line, diagnostics)
@ -157,6 +164,7 @@ local function sort_select(action_tuples, opts, on_user_choice)
end)
end
opts.width = config.width
trace(action_tuples)
require('guihua.gui').select(action_tuples, opts, on_user_choice)
end

@ -23,8 +23,8 @@ function M.new_list_view(opts)
end
local items = opts.items
opts.height_ratio = opts.height or config.height
opts.width_ratio = opts.height or config.width
opts.height_ratio = opts.height_ratio or config.height
opts.width_ratio = opts.width_ratio or config.width
opts.preview_height_ratio = opts.preview_height or config.preview_height
opts.preview_lines = config.preview_lines
if opts.rawdata then

@ -74,7 +74,7 @@ M.on_attach = function(client, bufnr)
if _NgConfigValues.lsp.code_action.enable then
if client.server_capabilities.codeActionProvider and client.name ~= 'null-ls' then
log('code action enabled for client', client.server_capabilities.codeActionProvider)
trace('code action enabled for client', client.server_capabilities.codeActionProvider)
api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
group = api.nvim_create_augroup('NGCodeActGroup_' .. tostring(bufnr), {}),
buffer = bufnr,

Loading…
Cancel
Save