Detailed changes
@@ -86,7 +86,7 @@
(identifier) @variable
((identifier) @constant
- (#match? @constant "^[A-Z][A-Z\\d_]*$"))
+ (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
(call_expression
function: (identifier) @function)
@@ -37,11 +37,11 @@
(type_identifier) @type
((identifier) @constant
- (#match? @constant "^[A-Z][A-Z\\d_]*$"))
+ (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
(field_identifier) @property
(statement_identifier) @label
-(this) @variable.builtin
+(this) @variable.special
[
"break"
@@ -41,10 +41,13 @@
(function_name) @function
-((property_name) @variable
- (#match? @variable "^--"))
-((plain_value) @variable
- (#match? @variable "^--"))
+(
+ [
+ (property_name)
+ (plain_value)
+ ] @variable.special
+ (#match? @variable.special "^--")
+)
[
"@media"
@@ -70,7 +73,6 @@
(unit) @type
[
- "#"
","
":"
] @punctuation.delimiter
@@ -51,12 +51,12 @@
(shorthand_property_identifier)
(shorthand_property_identifier_pattern)
] @constant
- (#match? @constant "^[A-Z_][A-Z\\d_]+$"))
+ (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
; Literals
-(this) @variable.builtin
-(super) @variable.builtin
+(this) @variable.special
+(super) @variable.special
[
(true)
@@ -21,7 +21,7 @@
(#match? @type "^[A-Z]"))
((identifier) @constant
- (#match? @constant "^[A-Z][A-Z_]*$"))
+ (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
; Builtin functions
@@ -1,6 +1,6 @@
(type_identifier) @type
(primitive_type) @type.builtin
-(self) @variable.builtin
+(self) @variable.special
(field_identifier) @property
(call_expression
@@ -27,22 +27,13 @@
; Identifier conventions
-; Assume uppercase names are enum constructors
-((identifier) @variant
- (#match? @variant "^[A-Z]"))
-
-; Assume that uppercase names in paths are types
-((scoped_identifier
- path: (identifier) @type)
- (#match? @type "^[A-Z]"))
-((scoped_identifier
- path: (scoped_identifier
- name: (identifier) @type))
+; Assume uppercase names are types/enum-constructors
+((identifier) @type
(#match? @type "^[A-Z]"))
; Assume all-caps names are constants
((identifier) @constant
- (#match? @constant "^[A-Z][A-Z\\d_]+$"))
+ (#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
[
"("
@@ -51,12 +51,12 @@
(shorthand_property_identifier)
(shorthand_property_identifier_pattern)
] @constant
- (#match? @constant "^[A-Z_][A-Z\\d_]+$"))
+ (#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
; Literals
-(this) @variable.builtin
-(super) @variable.builtin
+(this) @variable.special
+(super) @variable.special
[
(true)
@@ -185,6 +185,10 @@ export function createTheme(
color: sample(ramps.neutral, 7),
weight: fontWeights.normal,
},
+ "variable.special": {
+ color: sample(ramps.blue, 0.80),
+ weight: fontWeights.normal,
+ },
comment: {
color: sample(ramps.neutral, 5),
weight: fontWeights.normal,
@@ -210,15 +214,11 @@ export function createTheme(
weight: fontWeights.normal,
},
constructor: {
- color: sample(ramps.blue, 0.5),
- weight: fontWeights.normal,
- },
- variant: {
- color: sample(ramps.blue, 0.5),
+ color: sample(ramps.cyan, 0.5),
weight: fontWeights.normal,
},
property: {
- color: sample(ramps.blue, 0.5),
+ color: sample(ramps.blue, 0.6),
weight: fontWeights.normal,
},
enum: {
@@ -43,7 +43,7 @@ export interface Syntax {
keyword: SyntaxHighlightStyle;
function: SyntaxHighlightStyle;
type: SyntaxHighlightStyle;
- variant: SyntaxHighlightStyle;
+ constructor: SyntaxHighlightStyle;
property: SyntaxHighlightStyle;
enum: SyntaxHighlightStyle;
operator: SyntaxHighlightStyle;