Skip to content

Commit

Permalink
Highlight null literal correctly
Browse files Browse the repository at this point in the history
If it is a property access identifier, it will be treated as a keyword,
otherwise as a literal
  • Loading branch information
tobil4sk committed Aug 19, 2024
1 parent 5f7a2e0 commit 5e97ced
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

; Literals
; --------
[(keyword) (null)] @keyword
[(keyword)] @keyword
; (type) @type
(type (identifier) !built_in) @type
(type built_in: (identifier)) @type.builtin
Expand All @@ -75,6 +75,7 @@
(bool) @constant
(operator) @operator
(escape_sequence) @punctuation
(null) @constant.builtin


; Tokens
Expand Down
2 changes: 1 addition & 1 deletion test/highlight/literals.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var x = null;
// <- keyword
// ^ keyword
// ^ constant.builtin

// int literal.
var x = 12;
Expand Down
3 changes: 3 additions & 0 deletions test/highlight/variable.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var a(null, null):Int;
// ^ keyword
// ^ keyword

0 comments on commit 5e97ced

Please sign in to comment.