fix: jump to tag if buffer has unsaved changes (#1230)

This commit is contained in:
Simon Hauser
2021-09-10 08:48:41 +02:00
committed by GitHub
parent 55ec6c5c9c
commit d2b768983c

View File

@@ -883,6 +883,17 @@ function make_entry.gen_from_ctags(opts)
end end
end end
local mt = {}
mt.__index = function(t, k)
if k == "path" then
local retpath = Path:new({ t.filename }):absolute()
if not vim.loop.fs_access(retpath, "R", nil) then
retpath = t.filename
end
return retpath
end
end
return function(line) return function(line)
if line == "" or line:sub(1, 1) == "!" then if line == "" or line:sub(1, 1) == "!" then
return nil return nil
@@ -900,26 +911,21 @@ function make_entry.gen_from_ctags(opts)
return nil return nil
end end
local ordinal local tag_entry = {}
if opts.only_sort_tags then if opts.only_sort_tags then
ordinal = tag tag_entry.ordinal = tag
else else
ordinal = file .. ": " .. tag tag_entry.ordinal = file .. ": " .. tag
end end
return { tag_entry.display = make_display
valid = true, tag_entry.scode = scode
ordinal = ordinal, tag_entry.tag = tag
display = make_display, tag_entry.filename = file
scode = scode, tag_entry.col = 1
tag = tag, tag_entry.lnum = lnum and tonumber(lnum) or 1
filename = file, return setmetatable(tag_entry, mt)
col = 1,
lnum = lnum and tonumber(lnum) or 1,
}
end end
end end