Skip to content

Syntax highlighting (Crystal) #4945

Answered by the-mikedavis
Jomy10 asked this question in General
Discussion options

You must be logged in to vote

It looks like the queries are invalid: you can see in the log file (:log-open within helix) that the query file fails the analysis phase because the "if", "else", and "while" nodes aren't in the grammar. You can check the grammar file here: https://github.com/will/tree-sitter-crystal/blob/main/grammar.js. Literal strings in the javascript grammar file can be queried with string literals (e.g. "struct", "enum") but the rest must be named nodes, e.g. (struct_definition), (enum_definition). See the tree-sitter docs on queries: https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries, https://tree-sitter.github.io/tree-sitter/syntax-highlighting#highlights

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Jomy10
Comment options

Answer selected by Jomy10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants