aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-08-19 19:15:16 +0200
committerGitHub <noreply@github.com>2021-08-19 19:15:16 +0200
commit69741107e6910351ae040714246cccaddbca30ae (patch)
tree5e374bf1d5372cac2e574eb46cce4c55a301e56d
parentff0833cb4eda9f27ec8748f388b151d785307359 (diff)
parent2460f0a7028550ea2d87492a4e8b95914fdba7b1 (diff)
downloadrneovim-69741107e6910351ae040714246cccaddbca30ae.tar.gz
rneovim-69741107e6910351ae040714246cccaddbca30ae.tar.bz2
rneovim-69741107e6910351ae040714246cccaddbca30ae.zip
Merge pull request #15429 from bfredl/hl_2
perf(treesitter): avoid string lookup of highlight name in hot loop
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index e003cf577a..bf5bd791c3 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -85,8 +85,10 @@ function TSHighlighterQuery.new(lang, query_string)
hl = _link_default_highlight_once(lang .. hl, hl)
end
- rawset(table, capture, hl)
- return hl
+ local id = a.nvim_get_hl_id_by_name(hl)
+
+ rawset(table, capture, id)
+ return id
end
})