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:
TJ DeVries
2021-04-06 19:59:42 -04:00
committed by GitHub
parent d0cf646f65
commit 0b2c801978
5 changed files with 104 additions and 3 deletions
+18 -2
View File
@@ -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