aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantos Gallegos <stsewd@proton.me>2023-06-18 09:42:17 -0500
committerGitHub <noreply@github.com>2023-06-18 16:42:17 +0200
commit8c9dab3e0d788d44c8a2fee83a6193f5955c814e (patch)
treeb3107b6bacec9e07211958beb6f6f18fa5df83ca
parent8a7e3353eb5bffb10015254917361266b4b20511 (diff)
downloadrneovim-8c9dab3e0d788d44c8a2fee83a6193f5955c814e.tar.gz
rneovim-8c9dab3e0d788d44c8a2fee83a6193f5955c814e.tar.bz2
rneovim-8c9dab3e0d788d44c8a2fee83a6193f5955c814e.zip
fix(treesitter): use vim.highlight.priorities instead of hardcoded 100 (#24052)
Problem: Treesitter highlighting base priority cannot be customized. Solution: Use `vim.highlight.priorities.treesitter` instead of hard-coded value.
-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 4bb764c5c6..d4db6bc404 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -260,12 +260,14 @@ local function on_line_impl(self, buf, line, is_spell_nav)
local spell_pri_offset = capture_name == 'nospell' and 1 or 0
if hl and end_row >= line and (not is_spell_nav or spell ~= nil) then
+ local priority = (tonumber(metadata.priority) or vim.highlight.priorities.treesitter)
+ + spell_pri_offset
api.nvim_buf_set_extmark(buf, ns, start_row, start_col, {
end_line = end_row,
end_col = end_col,
hl_group = hl,
ephemeral = true,
- priority = (tonumber(metadata.priority) or 100) + spell_pri_offset, -- Low but leaves room below
+ priority = priority,
conceal = metadata.conceal,
spell = spell,
})