mirror of
https://github.com/zoriya/telescope.nvim.git
synced 2026-05-27 00:23:47 +00:00
feat: buf highlights for current buffer fuzzy find (#732)
* feat: Add buffer highlights from treesitter * fix: Handle not having tree sitter in some buffers * fixup * fixup * fixup: move back to old node
This commit is contained in:
@@ -685,14 +685,30 @@ function make_entry.gen_from_buffer_lines(opts)
|
||||
separator = ' │ ',
|
||||
items = {
|
||||
{ width = 5 },
|
||||
{ remaining = true },
|
||||
{ remaining = true, },
|
||||
},
|
||||
}
|
||||
|
||||
local make_display = function(entry)
|
||||
|
||||
return displayer {
|
||||
{ entry.lnum, opts.lnum_highlight_group or 'TelescopeResultsSpecialComment' },
|
||||
entry.line
|
||||
{
|
||||
entry.line, function()
|
||||
if not opts.line_highlights then return {} end
|
||||
|
||||
local line_hl = opts.line_highlights[entry.lnum] or {}
|
||||
-- TODO: We could probably squash these together if the are the same...
|
||||
-- But I don't think that it's worth it at the moment.
|
||||
local result = {}
|
||||
|
||||
for col, hl in pairs(line_hl) do
|
||||
table.insert(result, { {col, col+1}, hl })
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user