Skip to content

Commit

Permalink
Use @boolean for true and false in highlights (#25338)
Browse files Browse the repository at this point in the history
Release Notes:

- Fixed issue where `true` and `false` were highlighted as constants,
ignoring the `boolean` highlight defined in themes.
  - This fix applies to: C, C++, Go, JSON, JSONC, Python, and Rust.

---------

Co-authored-by: Marshall Bowers <[email protected]>
  • Loading branch information
everdrone and maxdeviant authored Feb 21, 2025
1 parent 3c4903c commit 1fb4620
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 4 deletions.
5 changes: 3 additions & 2 deletions crates/languages/src/c/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@
[
(true)
(false)
(null)
] @constant
] @boolean

(null) @constant

(identifier) @variable

Expand Down
3 changes: 3 additions & 0 deletions crates/languages/src/cpp/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ type :(primitive_type) @type.primitive
[
(true)
(false)
] @boolean

[
(null)
("nullptr")
] @constant
Expand Down
3 changes: 3 additions & 0 deletions crates/languages/src/go/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
[
(true)
(false)
] @boolean

[
(nil)
(iota)
] @constant.builtin
Expand Down
3 changes: 3 additions & 0 deletions crates/languages/src/json/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
[
(true)
(false)
] @boolean

[
(null)
] @constant

Expand Down
3 changes: 3 additions & 0 deletions crates/languages/src/jsonc/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
[
(true)
(false)
] @boolean

[
(null)
] @constant

Expand Down
5 changes: 4 additions & 1 deletion crates/languages/src/python/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@
; Literals

[
(none)
(true)
(false)
] @boolean

[
(none)
(ellipsis)
] @constant.builtin

Expand Down
2 changes: 1 addition & 1 deletion crates/languages/src/rust/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
(float_literal)
] @number

(boolean_literal) @constant
(boolean_literal) @boolean

[
(line_comment)
Expand Down

0 comments on commit 1fb4620

Please sign in to comment.