optimize jump to position

improve jump location
neovim_0_5
ray-x 3 years ago
parent 1acfe90f12
commit baad5112d8

@ -14,7 +14,7 @@ _NgConfigValues = {
lsp = {
format_on_save = true, -- set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc)
tsserver = {
filetypes = {'typescript'} -- disable javascript etc,
-- filetypes = {'typescript'} -- disable javascript etc,
-- set to {} to disable the lspclient for all filetype
},
sumneko_lua = {

@ -127,6 +127,7 @@ function M.new_list_view(opts)
if opts.rawdata then
data = items
else
log(items)
data = require"navigator.render".prepare_for_render(items, opts)
end
@ -175,7 +176,7 @@ function M.new_list_view(opts)
if pos == 0 then
pos = 1
end
local l = idx(data, pos) -- bug it not work with fzy filter
local l = idx(data, pos)
if l.filename ~= nil then
log("openfile ", l.filename, l.lnum, l.col)
util.open_file_at(l.filename, l.lnum, l.col)

@ -38,6 +38,9 @@ local function get_pads(win_width, text, postfix)
end
if i > 3 then
i = i - 3
end
space = string.rep(' ', i)
trace(text, i, postfix, win_width)
return space, trim
@ -86,6 +89,7 @@ function M.prepare_for_render(items, opts)
trace(items[1], lspapi_display, display_items[last_summary_idx])
end
display_items[last_summary_idx].filename_only = true
-- trace(items[i], items[i].filename, last_summary_idx, display_items[last_summary_idx].filename)
-- TODO refact display_filename generate part
if items[i].filename == fn then
@ -190,6 +194,7 @@ function M.prepare_for_render(items, opts)
end
end
display_items[last_summary_idx].filename_only = true
-- display_items[last_summary_idx].text=string.format("%s [%i]", display_items[last_summary_idx].filename,
-- total_ref_in_file)
return display_items

@ -274,7 +274,7 @@ end
M.open_file_at = function(filename, line, col)
vim.api.nvim_command(string.format("e! +%s %s", line, filename))
col = col or 1
vim.api.nvim_command(string.format("normal! %dl", col - 1))
vim.fn.cursor(line, col)
end
function M.exists(var)

Loading…
Cancel
Save