diff options
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index aca8894..09c7d30 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -28,7 +28,7 @@ function make_entry.gen_from_string() return function(line) return { valid = line ~= "", - entry_type = make_entry.types.SIMPLE, + entry_type = make_entry.types.GENERIC, value = line, ordinal = line, @@ -40,6 +40,8 @@ end function make_entry.gen_from_file(opts) opts = opts or {} + local cwd = vim.fn.expand(opts.cwd or vim.fn.getcwd()) + local make_display = function(line) local display = line if opts.shorten_path then @@ -58,6 +60,7 @@ function make_entry.gen_from_file(opts) entry_type = make_entry.types.FILE, filename = line, + path = cwd .. '/' .. line, } entry.display = make_display(line) @@ -101,6 +104,13 @@ function make_entry.gen_from_vimgrep(opts) -- Or could we just walk the text and check for colons faster? local _, _, filename, lnum, col, text = string.find(line, [[([^:]+):(%d+):(%d+):(.*)]]) + local ok + ok, lnum = pcall(tonumber, lnum) + if not ok then lnum = nil end + + ok, col = pcall(tonumber, col) + if not ok then col = nil end + return { valid = line ~= "", |
