From a0b37473a924083386118c8467717843cfb6b0cb Mon Sep 17 00:00:00 2001 From: Simon Hauser Date: Thu, 31 Dec 2020 16:17:09 +0100 Subject: fix: tags now work with hasktags (#375) --- lua/telescope/make_entry.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lua/telescope/make_entry.lua') 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 -- cgit v1.2.3