perf(picker): cache treesitter line highlights

This commit is contained in:
Folke Lemaitre 2025-02-05 20:32:30 +01:00
parent 1bbc8f90fd
commit af31c31287
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 12 additions and 5 deletions

View file

@ -5,7 +5,7 @@ local M = {}
function M.lines(opts)
local buf = opts.buf or 0
buf = buf == 0 and vim.api.nvim_get_current_buf() or buf
local extmarks = require("snacks.picker.util.highlight").get_highlights({ buf = buf })
local extmarks = require("snacks.picker.util.highlight").get_highlights({ buf = buf, extmarks = true })
local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false)
local items = {} ---@type snacks.picker.finder.Item[]
for l, line in ipairs(lines) do