Skip to content

Commit a86c350

Browse files
authored
feature: improve highlighting for comment inside function (#218)
1 parent 1bf072f commit a86c350

5 files changed

+68
-2
lines changed

src/tokenizeCss.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,10 @@ export const tokenizeLine = (line, lineState) => {
602602
token = TokenType.Punctuation
603603
state = State.InsideSingleQuoteString
604604
stack.push(State.AfterFunctionName)
605+
} else if ((next = part.match(RE_BLOCK_COMMENT_START))) {
606+
token = TokenType.Comment
607+
stack.push(state)
608+
state = State.InsideBlockComment
605609
} else if ((next = part.match(RE_PROPERTY_VALUE_INSIDE_FUNCTION))) {
606610
token = TokenType.CssPropertyValue
607611
state = State.AfterFunctionName
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CssSelector
2+
Whitespace
3+
Punctuation
4+
NewLine
5+
Whitespace
6+
CssPropertyName
7+
Punctuation
8+
Whitespace
9+
Function
10+
Punctuation
11+
Comment
12+
Comment
13+
Numeric
14+
Comment
15+
Comment
16+
Comment
17+
Punctuation
18+
Numeric
19+
Punctuation
20+
Comment
21+
Comment
22+
Comment
23+
Numeric
24+
Comment
25+
Comment
26+
Comment
27+
Numeric
28+
Punctuation
29+
NewLine
30+
Punctuation

test/baselines/vscode-css-property-lists-declaration-blocks-values-functional-notation-colours-matches-comments-between-colour-components.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ Punctuation
66
Whitespace
77
Function
88
Punctuation
9-
CssPropertyValue
9+
Comment
10+
Comment
11+
Numeric
12+
Comment
13+
Comment
14+
Comment
15+
Punctuation
16+
Numeric
17+
Punctuation
18+
Comment
19+
Comment
20+
Comment
21+
Numeric
22+
Comment
23+
Comment
24+
Comment
25+
Numeric
1026
Punctuation
1127
Punctuation

test/baselines/vscode-css-property-lists-declaration-blocks-values-functional-notation-timing-functions-them-correctly.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ Punctuation
66
Whitespace
77
Function
88
Punctuation
9-
CssPropertyValue
9+
Comment
10+
Comment
11+
Numeric
12+
Punctuation
13+
Comment
14+
Comment
15+
Comment
16+
Numeric
17+
Punctuation
18+
Numeric
19+
Punctuation
20+
Numeric
21+
Comment
22+
Comment
1023
Punctuation
1124
Punctuation
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a {
2+
color: rgba(/**/255/*=*/,0,/*2.2%*/51/*,*/0.2)
3+
}

0 commit comments

Comments
 (0)