fix: tags now work with hasktags (#375)

This commit is contained in:
Simon Hauser
2020-12-31 16:17:09 +01:00
committed by GitHub
parent 686d560fa5
commit a0b37473a9
3 changed files with 51 additions and 23 deletions

View File

@@ -834,7 +834,13 @@ function make_entry.gen_from_ctags(opts)
return nil
end
local tag, file, scode = string.match(line, '([^\t]+)\t([^\t]+)\t/^\t?(.*)/;"\t+.*')
local tag, file, scode, lnum
-- ctags gives us: 'tags\tfile\tsource'
tag, file, scode = string.match(line, '([^\t]+)\t([^\t]+)\t/^\t?(.*)/;"\t+.*')
if not tag then
-- hasktags gives us: 'tags\tfile\tlnum'
tag, file, lnum = string.match(line, '([^\t]+)\t([^\t]+)\t(%d+).*')
end
if opts.only_current_file and file ~= current_file then
return nil
@@ -851,7 +857,7 @@ function make_entry.gen_from_ctags(opts)
filename = file,
col = 1,
lnum = 1,
lnum = lnum and tonumber(lnum) or 1,
}
end
end