summaryrefslogtreecommitdiff
path: root/lua/telescope/make_entry.lua
diff options
context:
space:
mode:
authorSimon Hauser <Simon-Hauser@outlook.de>2020-12-31 16:17:09 +0100
committerGitHub <noreply@github.com>2020-12-31 16:17:09 +0100
commita0b37473a924083386118c8467717843cfb6b0cb (patch)
tree68fdbd952bc15a0c1f70c9073d7d620d5ee76c32 /lua/telescope/make_entry.lua
parent686d560fa50e130801d5bd64493d79f1c65e3f7c (diff)
fix: tags now work with hasktags (#375)
Diffstat (limited to 'lua/telescope/make_entry.lua')
-rw-r--r--lua/telescope/make_entry.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index c1a4f66..d653f9e 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -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