aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/highlighter.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-01-06 07:09:34 -0800
committerGitHub <noreply@github.com>2025-01-06 07:09:34 -0800
commit3d9fb975b957c12d412ddc508998cf59aac2a4d7 (patch)
tree673b598c36c90019cb2dfcb03c4b7dab0e1120da /runtime/lua/vim/treesitter/highlighter.lua
parent86770108e2c6e08c2b8b95f1611923ba99b854dd (diff)
parentdd234135ad20119917831fd8ffcb19d8562022ca (diff)
downloadrneovim-3d9fb975b957c12d412ddc508998cf59aac2a4d7.tar.gz
rneovim-3d9fb975b957c12d412ddc508998cf59aac2a4d7.tar.bz2
rneovim-3d9fb975b957c12d412ddc508998cf59aac2a4d7.zip
Merge #31625 perf(decor): improve iter_captures() cache
Diffstat (limited to 'runtime/lua/vim/treesitter/highlighter.lua')
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index 8ce8652f7d..96503c38ea 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -299,6 +299,8 @@ local function on_line_impl(self, buf, line, is_spell_nav)
state.highlighter_query:query():iter_captures(root_node, self.bufnr, line, root_end_row + 1)
end
+ local captures = state.highlighter_query:query().captures
+
while line >= state.next_row do
local capture, node, metadata, match = state.iter(line)
@@ -311,7 +313,7 @@ local function on_line_impl(self, buf, line, is_spell_nav)
if capture then
local hl = state.highlighter_query:get_hl_from_capture(capture)
- local capture_name = state.highlighter_query:query().captures[capture]
+ local capture_name = captures[capture]
local spell, spell_pri_offset = get_spell(capture_name)