mirror of
https://github.com/neovim/neovim.git
synced 2025-12-08 15:42:52 +00:00
docs(tree-sitter): document highlight priority
This commit is contained in:
@@ -2334,8 +2334,9 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
|
|||||||
inserted (true for right, false for left).
|
inserted (true for right, false for left).
|
||||||
Defaults to false.
|
Defaults to false.
|
||||||
• priority: a priority value for the highlight
|
• priority: a priority value for the highlight
|
||||||
group. For example treesitter highlighting
|
group. Default: 4096. For example, treesitter
|
||||||
uses a value of 100.
|
highlighting uses a default value of 100 (see
|
||||||
|
|lua-treesitter-highlight-priority|).
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
Id of the created/updated extmark
|
Id of the created/updated extmark
|
||||||
|
|||||||
@@ -294,6 +294,19 @@ identical identifiers, highlighting both as |hl-WarningMsg|: >
|
|||||||
((binary_expression left: (identifier) @WarningMsg.left right: (identifier) @WarningMsg.right)
|
((binary_expression left: (identifier) @WarningMsg.left right: (identifier) @WarningMsg.right)
|
||||||
(eq? @WarningMsg.left @WarningMsg.right))
|
(eq? @WarningMsg.left @WarningMsg.right))
|
||||||
<
|
<
|
||||||
|
Treesitter Highlighting Priority *lua-treesitter-highlight-priority*
|
||||||
|
|
||||||
|
Tree-sitter uses |nvim_buf_set_extmark()| to set highlights with a default
|
||||||
|
priority of 100. This enables plugins to set a highlighting priority lower or
|
||||||
|
higher than tree-sitter. It is also possible to change the priority of an
|
||||||
|
individual query pattern manually by setting its `"priority"` metadata attribute: >
|
||||||
|
|
||||||
|
(
|
||||||
|
(super_important_node) @ImportantHighlight
|
||||||
|
; Give the whole query highlight priority higher than the default (100)
|
||||||
|
(set! "priority" 105)
|
||||||
|
)
|
||||||
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Lua module: vim.treesitter *lua-treesitter-core*
|
Lua module: vim.treesitter *lua-treesitter-core*
|
||||||
|
|||||||
Reference in New Issue
Block a user