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:
Oscar
2023-06-25 21:16:15 +02:00
committed by GitHub
parent 219584a6ef
commit 6074847b6e
2 changed files with 27 additions and 4 deletions

View File

@@ -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