Maintain consistency in syntax highlighting patterns by using appropriate, specific scopes and avoiding overly complex or noisy patterns. Follow Helix-specific conventions rather than generic tree-sitter patterns.
Maintain consistency in syntax highlighting patterns by using appropriate, specific scopes and avoiding overly complex or noisy patterns. Follow Helix-specific conventions rather than generic tree-sitter patterns.
Key guidelines:
@keyword.control.repeat
instead of generic @keyword
when appropriate@constant.numeric.integer
instead of generic @number
(ERROR) @error
that distract during typing#any-of?
for multiple similar matches#match?
instead of platform-specific ones like #lua-match?
Example of good pattern specificity:
; Good - specific scopes
[
"for"
"while"
] @keyword.control.repeat
[
"if"
"else"
] @keyword.control.conditional
; Avoid - overly generic
[
"for"
"while"
"if"
"else"
] @keyword
Example of proper precedence:
; Specific pattern first
((comment) @comment.block.documentation
(#match? @comment.block.documentation "^//!"))
; Generic pattern second
(comment) @comment.line
This approach ensures highlighting is consistent, follows project conventions, and provides clear visual feedback without being distracting or overly complex.
Enter the URL of a public GitHub repository