Skip to content

Commit

Permalink
Improve CSS syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
chbk committed Feb 21, 2025
1 parent dff47a8 commit f26faac
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions crates/languages/src/css/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
">"
"+"
"-"
"|"
"*"
"/"
"="
Expand All @@ -19,35 +20,48 @@
"~="
"$="
"*="
] @operator

[
"and"
"or"
"not"
"only"
] @operator
] @keyword.operator

(attribute_selector (plain_value) @string)

[
(id_name)
(class_name)
] @selector

(namespace_name) @namespace
(namespace_selector (tag_name) @namespace "|")

(attribute_name) @attribute
(pseudo_element_selector (tag_name) @attribute)
(pseudo_class_selector (class_name) @attribute)
(pseudo_element_selector "::" (tag_name) @attribute)
(pseudo_class_selector ":" (class_name) @attribute)

[
(class_name)
(id_name)
(namespace_name)
(feature_name)
(property_name)
] @property

(property_name) @constant

(function_name) @function

[
(plain_value)
(keyframes_name)
(keyword_query)
] @constant

(
[
(property_name)
(plain_value)
] @variable.special
(#match? @variable.special "^--")
] @variable
(#match? @variable "^--")
)

[
Expand All @@ -61,7 +75,7 @@
(to)
(from)
(important)
] @keyword
] @keyword

(string_value) @string
(color_value) @string.special
Expand All @@ -71,15 +85,15 @@
(float_value)
] @number

(unit) @type
(unit) @constant.unit

[
","
":"
"."
"::"
";"
"#"
(id_selector "#")
] @punctuation.delimiter

[
Expand Down

0 comments on commit f26faac

Please sign in to comment.