Skip to content

Commit 9a97982

Browse files
authored
change quickfix make_entry to use column displayer (#331)
* change quickfix make_entry to use column displayer * fix: don't convert filename to empty string
1 parent 7b5411c commit 9a97982

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

lua/telescope/make_entry.lua

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,24 +233,31 @@ function make_entry.gen_from_quickfix(opts)
233233
opts = opts or {}
234234
opts.tail_path = get_default(opts.tail_path, true)
235235

236-
local make_display = function(entry)
237-
local to_concat = {}
236+
local displayer = entry_display.create {
237+
separator = "",
238+
items = {
239+
{ width = 6 },
240+
{ width = 50 },
241+
{ remaining = true },
242+
},
243+
}
238244

245+
local make_display = function(entry)
246+
local filename
239247
if not opts.hide_filename then
240-
local filename = entry.filename
248+
filename = entry.filename
241249
if opts.tail_path then
242250
filename = utils.path_tail(filename)
243251
elseif opts.shorten_path then
244252
filename = utils.path_shorten(filename)
245253
end
246-
247-
table.insert(to_concat, filename)
248-
table.insert(to_concat, ":")
249254
end
250255

251-
table.insert(to_concat, entry.text)
252-
253-
return table.concat(to_concat, "")
256+
return displayer {
257+
entry.lnum .. ":" .. entry.col,
258+
entry.text:gsub(".* | ", ""),
259+
filename,
260+
}
254261
end
255262

256263
return function(entry)

0 commit comments

Comments
 (0)