Skip to content

Commit 5c89b88

Browse files
rockerBOOamaanq
authored andcommitted
feat: add highlight test
1 parent c0d581e commit 5c89b88

File tree

2 files changed

+92
-10
lines changed

2 files changed

+92
-10
lines changed

queries/highlights.scm

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@
2323
"only" @operator
2424

2525
(attribute_selector (plain_value) @string)
26-
(pseudo_element_selector (tag_name) @attribute)
27-
(pseudo_class_selector (class_name) @attribute)
26+
27+
((property_name) @variable
28+
(#match? @variable "^--"))
29+
((plain_value) @variable
30+
(#match? @variable "^--"))
2831

2932
(class_name) @property
3033
(id_name) @property
3134
(namespace_name) @property
3235
(property_name) @property
3336
(feature_name) @property
3437

38+
(pseudo_element_selector (tag_name) @attribute)
39+
(pseudo_class_selector (class_name) @attribute)
3540
(attribute_name) @attribute
3641

3742
(function_name) @function
3843

39-
((property_name) @variable
40-
(#match? @variable "^--"))
41-
((plain_value) @variable
42-
(#match? @variable "^--"))
43-
4444
"@media" @keyword
4545
"@import" @keyword
4646
"@charset" @keyword
@@ -59,6 +59,18 @@
5959
(float_value) @number
6060
(unit) @type
6161

62-
"#" @punctuation.delimiter
63-
"," @punctuation.delimiter
64-
":" @punctuation.delimiter
62+
[
63+
"#"
64+
","
65+
"."
66+
":"
67+
"::"
68+
";"
69+
] @punctuation.delimiter
70+
71+
[
72+
"{"
73+
")"
74+
"("
75+
"}"
76+
] @punctuation.bracket

test/highlight/test_css.css

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
:root {
2+
/* <- attribute */
3+
/* <- punctuation.delimiter */
4+
--color1: #000;
5+
/* <- property */
6+
/* ^ string.special */
7+
/* ^ punctuation.delimiter */
8+
--color2: rgba(255, 255, 255, 1);
9+
/* ^ function */
10+
/* ^ punctuation.delimiter */
11+
12+
--font-family: 'Times New Roman', sans-serif;
13+
--spacing: .3em;
14+
15+
--gap: 8px;
16+
}
17+
18+
body {
19+
/* <- tag */
20+
font-family: var(--font-family);
21+
/* ^ function */
22+
/* ^ punctuation.bracket */
23+
/* ^ variable */
24+
}
25+
26+
a {
27+
color: blue;
28+
}
29+
30+
a:href {
31+
color: green;
32+
}
33+
34+
#logo {
35+
/* <- punctuation.delimiter */
36+
/* ^ property */
37+
/* ^ punctuation.bracket */
38+
font-family: sans-serif;
39+
/* <- property */
40+
/* ^ punctuation.delimiter */
41+
/* ^ punctuation.delimiter */
42+
font: normal bold 1rem / 1.4 'Times New Roman', sans-serif;
43+
/* ^ punctuation.delimiter */
44+
/* ^ operator */
45+
/* ^ number */
46+
/* ^ punctuation.delimiter */
47+
/* ^ string */
48+
/* ^ number */
49+
/* ^ type */
50+
padding: 0px 0px;
51+
/* ^ punctuation.delimiter */
52+
/* ^ number */
53+
/* ^ type */
54+
/* <- property */
55+
}
56+
/* <- punctuation.bracket */
57+
58+
@media (max-width: 1024px) {
59+
/* ^ number */
60+
/* ^ type */
61+
/* ^ property */
62+
/* <- keyword */
63+
/* ^ punctuation.bracket */
64+
/* ^ punctuation.bracket */
65+
.container {
66+
/* <- property */
67+
/* <- punctuation.delimiter */
68+
display: flex;
69+
}
70+
}

0 commit comments

Comments
 (0)