Fix tagrelative option not considered in builtin.tags (#2583)
* Fix tagrelative option not considered in builtin.tags * Fix wrong notify name * ctags filtering with grep or rg and normalize path * pass stylua check --------- Co-authored-by: James Trew <j.trew10@gmail.com>
This commit is contained in:
@@ -1086,9 +1086,9 @@ function make_entry.gen_from_ctags(opts)
|
||||
|
||||
local current_file_cache = {}
|
||||
return function(line)
|
||||
if line == "" or line:sub(1, 1) == "!" then
|
||||
return nil
|
||||
end
|
||||
local tag_file
|
||||
-- split line by ':'
|
||||
tag_file, line = string.match(line, "([^:]+):(.+)")
|
||||
|
||||
local tag, file, scode, lnum
|
||||
-- ctags gives us: 'tags\tfile\tsource'
|
||||
@@ -1098,6 +1098,12 @@ function make_entry.gen_from_ctags(opts)
|
||||
tag, file, lnum = string.match(line, "([^\t]+)\t([^\t]+)\t(%d+).*")
|
||||
end
|
||||
|
||||
-- append tag file path
|
||||
if vim.opt.tagrelative:get() then
|
||||
local tag_path = Path:new(tag_file):parent()
|
||||
file = Path:new(tag_path .. "/" .. file):normalize(cwd)
|
||||
end
|
||||
|
||||
if Path.path.sep == "\\" then
|
||||
file = string.gsub(file, "/", "\\")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user