issue #291 config option for listview mode

pull/293/head
ray-x 6 months ago
parent 7632117666
commit 5c9719b235

@ -24,6 +24,7 @@ _NgConfigValues = {
border = 'single', -- border style, can be one of 'none', 'single', 'double', "shadow"
lines_show_prompt = 10, -- when the result list items number more than lines_show_prompt,
prompt_mode = 'insert', -- 'normal' | 'insert'
-- fuzzy finder prompt will be shown
combined_attach = 'both', -- both: use both customized attach and navigator default attach, mine: only use my attach defined in vimrc
on_attach = function(client, bufnr)

@ -47,7 +47,9 @@ local function error_marker(result, ctx, config)
return
end
vim.defer_fn(function()
local async
local uv = vim.uv or vim.loop
async = uv.new_async(vim.schedule_wrap(function()
if vim.tbl_isempty(result.diagnostics) then
return
end
@ -173,7 +175,11 @@ local function error_marker(result, ctx, config)
{ virt_text = { { s.sign, hl } }, virt_text_pos = 'right_align' }
)
end
end, 10) -- defer in 10ms
async:close()
end))
vim.defer_fn(function()
async:send()
end, 10)
end
local update_err_marker_async = function()

@ -52,6 +52,7 @@ function M.new_list_view(opts)
opts.transparency = config.transparency
if #items >= config.lines_show_prompt then
opts.prompt = true
opts.enter = _NgConfigValues.prompt_mode == 'insert'
end
opts.external = config.external

@ -425,7 +425,7 @@ function M.locations_to_items(locations, ctx)
end
item.display_filename = filename or item.filename
item.call_by = context -- find_ts_func_by_range(funcs, item.range)
item.rpath = util.get_relative_path(cwd, item.filename)
item.rpath = util.get_relative_path(cwd, gutil.add_pec(item.filename))
width = math.max(width, #item.text)
item.symbol_name = M.get_symbol(item.text, item.range)
item.lhs = check_lhs(item.text, item.symbol_name)

@ -3,6 +3,7 @@
-- Some of function copied from https://github.com/RishabhRD/nvim-lsputils
local M = { log_path = vim.lsp.get_log_path() }
-- local is_windows = uv.os_uname().version:match("Windows")
pcall(require, 'guihua') -- lazy load
local guihua = require('guihua.util')
local nvim_0_8
local vfn = vim.fn
@ -116,6 +117,7 @@ function M.get_base(path)
return ret
end
end
return ''
end
local function getDir(path)
@ -137,6 +139,7 @@ local function getDir(path)
end
function M.get_relative_path(base_path, my_path)
M.log('rel path', base_path, my_path)
local base_data = getDir(base_path)
if base_data == nil then
return
@ -186,7 +189,8 @@ function M.setup()
elseif _NgConfigValues.debug == 'trace' then
level = 'trace'
end
local default_config = { use_console = false, use_file = true, level = level, plugin = 'navigator' }
local default_config =
{ use_console = false, use_file = true, level = level, plugin = 'navigator' }
if _NgConfigValues.debug_console_output then
default_config.use_console = true
default_config.use_file = false
@ -357,7 +361,13 @@ function M.set_virt_eol(bufnr, lnum, chunks, priority, id)
bufnr = bufnr == 0 and api.nvim_get_current_buf() or bufnr
bufs[bufnr] = true
-- id may be nil
return api.nvim_buf_set_extmark(bufnr, nss, lnum, -1, { id = id, virt_text = chunks, priority = priority })
return api.nvim_buf_set_extmark(
bufnr,
nss,
lnum,
-1,
{ id = id, virt_text = chunks, priority = priority }
)
end
function M.clear_buf(bufnr)

Loading…
Cancel
Save