Prompt
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:
- Use specific scopes like
@keyword.control.repeatinstead of generic@keywordwhen appropriate - Use Helix-specific scopes like
@constant.numeric.integerinstead of generic@number - Avoid overly complex patterns that try to guess highlighting context
- Remove noisy patterns like
(ERROR) @errorthat distract during typing - Use efficient patterns like
#any-of?for multiple similar matches - Ensure proper pattern precedence ordering (specific patterns before generic ones)
- Use cross-compatible predicates like
#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.