Skip to content

Commit c1f91c6

Browse files
committed
perf(treesitter): set regions early
1 parent 254145f commit c1f91c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/trouble/view/treesitter.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ function M._attach_lang(buf, lang, regions)
6565
M.cache[buf] = M.cache[buf] or {}
6666

6767
if not M.cache[buf][lang] then
68-
local ok, parser = pcall(vim.treesitter.get_parser, buf, lang)
68+
local ok, parser = pcall(vim.treesitter.languagetree.new, buf, lang)
6969
if not ok then
7070
local msg = "nvim-treesitter parser missing `" .. lang .. "`"
7171
vim.notify_once(msg, vim.log.levels.WARN, { title = "trouble.nvim" })
7272
return
7373
end
7474

75+
parser:set_included_regions(regions)
7576
M.cache[buf][lang] = {
7677
parser = parser,
7778
highlighter = TSHighlighter.new(parser),

0 commit comments

Comments
 (0)