Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix null and boolean constants in tree-sitter-nix highlights queries #1428

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion runtime/queries/nix/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
] @keyword

((identifier) @variable.builtin
(#match? @variable.builtin "^(__currentSystem|__currentTime|__nixPath|__nixVersion|__storeDir|builtins|false|null|true)$")
(#match? @variable.builtin "^(__currentSystem|__currentTime|__nixPath|__nixVersion|__storeDir|builtins)$")
(#is-not? local))

((identifier) @function.builtin
Expand All @@ -33,6 +33,11 @@

(uri) @string.special.uri

; boolean
((identifier) @constant.builtin.boolean (#match? @constant.builtin.boolean "^(true|false)$")) @constant.builtin.boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just be ["true" "false"] @constant.builtin.boolean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this doesn't work as true and false is recognized as identifier:
thread 'main' panicked at 'Query error at 37:3. Invalid node type true', helix-core/src/syntax.rs:207:29

; null
((identifier) @constant.builtin (#eq? @constant.builtin "null")) @constant.builtin

(integer) @constant.numeric.integer
(float) @constant.numeric.float

Expand Down