Skip to content

Commit 422ff19

Browse files
committed
[less] update grammar
1 parent da45ae9 commit 422ff19

4 files changed

Lines changed: 293 additions & 45 deletions

File tree

extensions/less/syntaxes/less.tmLanguage.json

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,7 @@
146146
"name": "comment.block.css"
147147
},
148148
{
149-
"match": "[+-]?\\d*\\.?\\d+",
150-
"name": "constant.numeric.css"
151-
},
152-
{
153-
"match": "(?<=[\\d])(ch|cm|deg|dpi|dpcm|dppx|em|ex|grad|in|mm|ms|pc|pt|px|rad|rem|turn|s|vh|vmin|vw)\\b|%",
154-
"name": "keyword.other.unit.css"
149+
"include": "source.css#numeric-values"
155150
},
156151
{
157152
"captures": {
@@ -281,13 +276,13 @@
281276
]
282277
},
283278
{
279+
"match": "(@|\\-\\-)[\\w-]+(?=\\s*)",
280+
"name": "variable.other.less",
284281
"captures": {
285282
"1": {
286283
"name": "punctuation.definition.variable.less"
287284
}
288-
},
289-
"match": "(?:@|\\-\\-)[a-zA-Z0-9_-][\\w-]*(?=\\s*)",
290-
"name": "variable.other.less"
285+
}
291286
},
292287
{
293288
"include": "#variable_interpolation"
@@ -516,7 +511,7 @@
516511
"include": "#strings"
517512
},
518513
{
519-
"match": "(\\b|\\.{0,2}/).*\\b",
514+
"match": "(\\b|\\.{0,2}/)[^)]*\\b",
520515
"name": "string.url.css"
521516
}
522517
]
@@ -546,5 +541,5 @@
546541
"name": "support.function.any-method.builtin.less"
547542
}
548543
},
549-
"version": "https://github.com/atom/language-less/commit/7d70b66aa9c853d59e27cce25b5bc25cb067e75a"
544+
"version": "https://github.com/atom/language-less/commit/4661d870784f725599e438bf683553cc6cf0f4ed"
550545
}

extensions/less/test/colorize-results/14119_less.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,18 @@
3333
}
3434
},
3535
{
36-
"c": "@hm",
36+
"c": "@",
37+
"t": "source.css.less variable.other.less punctuation.definition.variable.less",
38+
"r": {
39+
"dark_plus": "variable.other.less: #9CDCFE",
40+
"light_plus": "variable.other.less: #FF0000",
41+
"dark_vs": "variable.other.less: #9CDCFE",
42+
"light_vs": "variable.other.less: #FF0000",
43+
"hc_black": "variable.other.less: #D4D4D4"
44+
}
45+
},
46+
{
47+
"c": "hm",
3748
"t": "source.css.less variable.other.less",
3849
"r": {
3950
"dark_plus": "variable.other.less: #9CDCFE",

extensions/less/test/colorize-results/test-cssvariables_less.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,18 @@
5555
}
5656
},
5757
{
58-
"c": "--spacing-unit",
58+
"c": "--",
59+
"t": "source.css.less meta.property-list.css variable.other.less punctuation.definition.variable.less",
60+
"r": {
61+
"dark_plus": "variable.other.less: #9CDCFE",
62+
"light_plus": "variable.other.less: #FF0000",
63+
"dark_vs": "variable.other.less: #9CDCFE",
64+
"light_vs": "variable.other.less: #FF0000",
65+
"hc_black": "variable.other.less: #D4D4D4"
66+
}
67+
},
68+
{
69+
"c": "spacing-unit",
5970
"t": "source.css.less meta.property-list.css variable.other.less",
6071
"r": {
6172
"dark_plus": "variable.other.less: #9CDCFE",
@@ -100,7 +111,7 @@
100111
},
101112
{
102113
"c": "px",
103-
"t": "source.css.less meta.property-list.css meta.property-value.css keyword.other.unit.css",
114+
"t": "source.css.less meta.property-list.css meta.property-value.css constant.numeric.css keyword.other.unit.px.css",
104115
"r": {
105116
"dark_plus": "keyword.other.unit: #B5CEA8",
106117
"light_plus": "keyword.other.unit: #09885A",
@@ -132,7 +143,18 @@
132143
}
133144
},
134145
{
135-
"c": "--cell-padding",
146+
"c": "--",
147+
"t": "source.css.less meta.property-list.css variable.other.less punctuation.definition.variable.less",
148+
"r": {
149+
"dark_plus": "variable.other.less: #9CDCFE",
150+
"light_plus": "variable.other.less: #FF0000",
151+
"dark_vs": "variable.other.less: #9CDCFE",
152+
"light_vs": "variable.other.less: #FF0000",
153+
"hc_black": "variable.other.less: #D4D4D4"
154+
}
155+
},
156+
{
157+
"c": "cell-padding",
136158
"t": "source.css.less meta.property-list.css variable.other.less",
137159
"r": {
138160
"dark_plus": "variable.other.less: #9CDCFE",

0 commit comments

Comments
 (0)