Merge pull request #1697 from zed-industries/css-highlighting-fixes
Highlighting fixes
This commit is contained in:
commit
00188511cb
9 changed files with 28 additions and 35 deletions
|
@ -86,7 +86,7 @@
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (identifier) @function)
|
function: (identifier) @function)
|
||||||
|
|
|
@ -37,11 +37,11 @@
|
||||||
(type_identifier) @type
|
(type_identifier) @type
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
|
||||||
|
|
||||||
(field_identifier) @property
|
(field_identifier) @property
|
||||||
(statement_identifier) @label
|
(statement_identifier) @label
|
||||||
(this) @variable.builtin
|
(this) @variable.special
|
||||||
|
|
||||||
[
|
[
|
||||||
"break"
|
"break"
|
||||||
|
|
|
@ -41,10 +41,13 @@
|
||||||
|
|
||||||
(function_name) @function
|
(function_name) @function
|
||||||
|
|
||||||
((property_name) @variable
|
(
|
||||||
(#match? @variable "^--"))
|
[
|
||||||
((plain_value) @variable
|
(property_name)
|
||||||
(#match? @variable "^--"))
|
(plain_value)
|
||||||
|
] @variable.special
|
||||||
|
(#match? @variable.special "^--")
|
||||||
|
)
|
||||||
|
|
||||||
[
|
[
|
||||||
"@media"
|
"@media"
|
||||||
|
@ -70,7 +73,6 @@
|
||||||
(unit) @type
|
(unit) @type
|
||||||
|
|
||||||
[
|
[
|
||||||
"#"
|
|
||||||
","
|
","
|
||||||
":"
|
":"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
|
@ -51,12 +51,12 @@
|
||||||
(shorthand_property_identifier)
|
(shorthand_property_identifier)
|
||||||
(shorthand_property_identifier_pattern)
|
(shorthand_property_identifier_pattern)
|
||||||
] @constant
|
] @constant
|
||||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
(#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
(this) @variable.builtin
|
(this) @variable.special
|
||||||
(super) @variable.builtin
|
(super) @variable.special
|
||||||
|
|
||||||
[
|
[
|
||||||
(true)
|
(true)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
(#match? @type "^[A-Z]"))
|
(#match? @type "^[A-Z]"))
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#match? @constant "^[A-Z][A-Z_]*$"))
|
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
|
||||||
|
|
||||||
; Builtin functions
|
; Builtin functions
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(type_identifier) @type
|
(type_identifier) @type
|
||||||
(primitive_type) @type.builtin
|
(primitive_type) @type.builtin
|
||||||
(self) @variable.builtin
|
(self) @variable.special
|
||||||
(field_identifier) @property
|
(field_identifier) @property
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
|
@ -27,22 +27,13 @@
|
||||||
|
|
||||||
; Identifier conventions
|
; Identifier conventions
|
||||||
|
|
||||||
; Assume uppercase names are enum constructors
|
; Assume uppercase names are types/enum-constructors
|
||||||
((identifier) @variant
|
((identifier) @type
|
||||||
(#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))
|
|
||||||
(#match? @type "^[A-Z]"))
|
(#match? @type "^[A-Z]"))
|
||||||
|
|
||||||
; Assume all-caps names are constants
|
; Assume all-caps names are constants
|
||||||
((identifier) @constant
|
((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)
|
||||||
(shorthand_property_identifier_pattern)
|
(shorthand_property_identifier_pattern)
|
||||||
] @constant
|
] @constant
|
||||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
(#match? @constant "^_*[A-Z_][A-Z\\d_]*$"))
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
(this) @variable.builtin
|
(this) @variable.special
|
||||||
(super) @variable.builtin
|
(super) @variable.special
|
||||||
|
|
||||||
[
|
[
|
||||||
(true)
|
(true)
|
||||||
|
|
|
@ -185,6 +185,10 @@ export function createTheme(
|
||||||
color: sample(ramps.neutral, 7),
|
color: sample(ramps.neutral, 7),
|
||||||
weight: fontWeights.normal,
|
weight: fontWeights.normal,
|
||||||
},
|
},
|
||||||
|
"variable.special": {
|
||||||
|
color: sample(ramps.blue, 0.80),
|
||||||
|
weight: fontWeights.normal,
|
||||||
|
},
|
||||||
comment: {
|
comment: {
|
||||||
color: sample(ramps.neutral, 5),
|
color: sample(ramps.neutral, 5),
|
||||||
weight: fontWeights.normal,
|
weight: fontWeights.normal,
|
||||||
|
@ -210,15 +214,11 @@ export function createTheme(
|
||||||
weight: fontWeights.normal,
|
weight: fontWeights.normal,
|
||||||
},
|
},
|
||||||
constructor: {
|
constructor: {
|
||||||
color: sample(ramps.blue, 0.5),
|
color: sample(ramps.cyan, 0.5),
|
||||||
weight: fontWeights.normal,
|
|
||||||
},
|
|
||||||
variant: {
|
|
||||||
color: sample(ramps.blue, 0.5),
|
|
||||||
weight: fontWeights.normal,
|
weight: fontWeights.normal,
|
||||||
},
|
},
|
||||||
property: {
|
property: {
|
||||||
color: sample(ramps.blue, 0.5),
|
color: sample(ramps.blue, 0.6),
|
||||||
weight: fontWeights.normal,
|
weight: fontWeights.normal,
|
||||||
},
|
},
|
||||||
enum: {
|
enum: {
|
||||||
|
|
|
@ -43,7 +43,7 @@ export interface Syntax {
|
||||||
keyword: SyntaxHighlightStyle;
|
keyword: SyntaxHighlightStyle;
|
||||||
function: SyntaxHighlightStyle;
|
function: SyntaxHighlightStyle;
|
||||||
type: SyntaxHighlightStyle;
|
type: SyntaxHighlightStyle;
|
||||||
variant: SyntaxHighlightStyle;
|
constructor: SyntaxHighlightStyle;
|
||||||
property: SyntaxHighlightStyle;
|
property: SyntaxHighlightStyle;
|
||||||
enum: SyntaxHighlightStyle;
|
enum: SyntaxHighlightStyle;
|
||||||
operator: SyntaxHighlightStyle;
|
operator: SyntaxHighlightStyle;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue