Skip to content

Commit aae33d7

Browse files
authored
consistently highlight null literals as @constant.builtin (#15264)
* highlights(amber): highlight (null) as `@constant.builtin` * highlights(c): highlight (null) as `@constant.builtin` * highlights(opencl): mark (null) as `@constant.builtin` * highlights(prisma): highlight (null) as `@constant.builtin` and not `@constant.builtin.boolean` * highlights(v): highlight (nil) as `@constant.builtin` * queries(crystal): properly highlight (nil) and booleans * highlight(gdscript): highlight (null) as `@constant.builtin` * highlights(r): properly highlight null and nan * highlights(kotlin): don't highlight null as boolean
1 parent 22c9e6a commit aae33d7

File tree

9 files changed

+32
-31
lines changed

9 files changed

+32
-31
lines changed

runtime/queries/amber/highlights.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
; Literals
3636
(boolean) @constant.builtin.boolean
3737
(number) @constant.numeric
38-
(null) @constant.numeric
38+
(null) @constant.builtin
3939
(string) @string
4040
(status) @keyword
4141
; Highlight only command delimiters, not content (bash injection handles content)

runtime/queries/c/highlights.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
(string_literal) @string
110110
(system_lib_string) @string
111111

112-
(null) @constant
112+
(null) @constant.builtin
113113
(number_literal) @constant.numeric
114114
(char_literal) @constant.character
115115
(escape_sequence) @constant.character.escape

runtime/queries/crystal/highlights.scm

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@
145145
[
146146
(true)
147147
(false)
148-
(nil)
149-
(self)
150-
] @variable.builtin
148+
] @constant.builtin.boolean
149+
150+
(nil) @constant.builtin
151+
152+
(self) @variable.builtin
151153

152154
(
153155
(comment)+ @comment.block.documentation

runtime/queries/gdscript/highlights.scm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@
3434
(binary_operator (identifier) @type)
3535
(enum_definition (name) @type.enum)
3636
(enumerator (identifier) @type.enum.variant)
37-
[
38-
(null)
39-
(underscore)
40-
] @type.builtin
37+
(underscore) @type.builtin
4138

4239

4340
(variable_statement (identifier) @variable)
@@ -63,6 +60,7 @@
6360
(true)
6461
(false)
6562
] @constant.builtin.boolean
63+
(null) @constant.builtin
6664

6765
[
6866
"+"

runtime/queries/kotlin/highlights.scm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,8 @@
162162

163163
(character_literal) @constant.character
164164

165-
[
166-
(null_literal) ; should be highlighted the same as booleans
167-
(boolean_literal)
168-
] @constant.builtin.boolean
165+
(boolean_literal) @constant.builtin.boolean
166+
(null_literal) @constant.builtin
169167

170168
(real_literal) @constant.numeric.float
171169
[

runtime/queries/opencl/highlights.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
(string_literal) @string
117117
(system_lib_string) @string
118118

119-
(null) @constant
119+
(null) @constant.builtin
120120
(number_literal) @constant.numeric
121121
(char_literal) @constant.character
122122

runtime/queries/prisma/highlights.scm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
[
3434
(true)
3535
(false)
36-
(null)
3736
] @constant.builtin.boolean
37+
(null) @constant.builtin
3838

3939
[
4040
"("
@@ -55,4 +55,4 @@
5555
"@"
5656
"@@"
5757
(binary_expression)
58-
] @operator
58+
] @operator

runtime/queries/r/highlights.scm

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,25 @@
44

55
; Literals
66

7-
(integer) @constant.numeric.integer
7+
[
8+
(integer)
9+
(complex)
10+
] @constant.numeric.integer
811

9-
(float) @constant.numeric.float
12+
[
13+
(float)
14+
(nan)
15+
] @constant.numeric.float
1016

11-
(complex) @constant.numeric.integer
17+
[
18+
(true)
19+
(false)
20+
] @constant.builtin.boolean
21+
22+
[
23+
(na)
24+
(null)
25+
] @constant.builtin
1226

1327
(string) @string
1428
(string (escape_sequence) @constant.character.escape)
@@ -86,12 +100,6 @@
86100
(inf)
87101
] @keyword
88102

89-
[
90-
(nan)
91-
(na)
92-
(null)
93-
] @type.builtin
94-
95103
[
96104
"if"
97105
"else"
@@ -104,11 +112,6 @@
104112
"for"
105113
] @keyword.control.repeat
106114

107-
[
108-
(true)
109-
(false)
110-
] @constant.builtin.boolean
111-
112115
"function" @keyword.function
113116

114117
(call function: (identifier) @function)

runtime/queries/v/highlights.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
(true)
9999
(false)
100100
] @constant.builtin.boolean
101+
(nil) @constant.builtin
101102

102103
[
103104
"pub"
@@ -106,7 +107,6 @@
106107
"defer"
107108
"unsafe"
108109
"sql"
109-
(nil)
110110
(none)
111111
] @keyword
112112

0 commit comments

Comments
 (0)