Skip to content

Commit 9e58c28

Browse files
committed
Update from extension
1 parent 8903ecf commit 9e58c28

File tree

2 files changed

+133
-20
lines changed

2 files changed

+133
-20
lines changed

src/vscode-css/grammars/css.cson

Lines changed: 66 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@
3434
{
3535
'include': '#rule-list'
3636
}
37+
{
38+
'include': '#nesting-selector'
39+
}
3740
]
3841
'repository':
42+
'arithmetic-operators':
43+
'match': '[*/]|(?<=\\s|^)[-+](?=\\s|$)'
44+
'name': 'keyword.operator.arithmetic.css'
3945
'at-rules':
4046
'patterns': [
4147
{
@@ -214,6 +220,9 @@
214220
'name': 'punctuation.section.media.end.bracket.curly.css'
215221
'name': 'meta.at-rule.media.body.css'
216222
'patterns': [
223+
{
224+
'include': '#rule-list-innards'
225+
}
217226
{
218227
'include': '$self'
219228
}
@@ -632,6 +641,9 @@
632641
'name': 'punctuation.section.end.bracket.curly.css'
633642
'name': 'meta.at-rule.body.css'
634643
'patterns': [
644+
{
645+
'include': '#rule-list-innards'
646+
}
635647
{
636648
'include': '$self'
637649
}
@@ -643,12 +655,12 @@
643655
'color-keywords':
644656
'patterns': [
645657
{
646-
# CSS 2.1 colours: http://www.w3.org/TR/CSS21/syndata.html#value-def-color
658+
# CSS 2.1 colors: http://www.w3.org/TR/CSS21/syndata.html#value-def-color
647659
'match': '(?i)(?<![\\w-])(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)(?![\\w-])'
648660
'name': 'support.constant.color.w3c-standard-color-name.css'
649661
}
650662
{
651-
# SVG/CSS3 colour names: http://www.w3.org/TR/css3-color/#svg-color
663+
# SVG/CSS3 color names: http://www.w3.org/TR/css3-color/#svg-color
652664
'match': '''(?xi) (?<![\\w-])
653665
(aliceblue|antiquewhite|aquamarine|azure|beige|bisque|blanchedalmond|blueviolet|brown|burlywood
654666
|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan
@@ -670,12 +682,12 @@
670682
'name': 'support.constant.color.w3c-extended-color-name.css'
671683
}
672684
{
673-
# Current text colour
685+
# Current text color
674686
'match': '(?i)(?<![\\w-])currentColor(?![\\w-])'
675687
'name': 'support.constant.color.current.css'
676688
}
677689
{
678-
# These colours are deprecated in CSS3: http://www.w3.org/TR/css3-color/#css2-system
690+
# These colors are deprecated in CSS3: http://www.w3.org/TR/css3-color/#css2-system
679691
'match': '''(?xi) (?<![\\w-])
680692
(ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonFace|ButtonHighlight|ButtonShadow
681693
|ButtonText|CaptionText|GrayText|Highlight|HighlightText|InactiveBorder|InactiveCaption
@@ -818,17 +830,19 @@
818830
'name': 'meta.function.calc.css'
819831
'patterns': [
820832
{
821-
'match': '[*/]|(?<=\\s|^)[-+](?=\\s|$)'
822-
'name': 'keyword.operator.arithmetic.css'
833+
'include': '#arithmetic-operators'
823834
}
824835
{
825836
'include': '#property-values'
826837
}
838+
{
839+
'include': '#function-nesting'
840+
}
827841
]
828842
}
829-
# Colours
843+
# colors
830844
{
831-
'begin': '(?i)(?<![\\w-])(rgba?|rgb|hsla?|hsl|hwb|lab|oklab|lch|oklch|color)(\\()'
845+
'begin': '(?i)(?<![\\w-])(rgba?|rgb|hsla?|hsl|hwb|lab|oklab|lch|oklch|color|light-dark)(\\()'
832846
'beginCaptures':
833847
'1':
834848
'name': 'support.function.misc.css'
@@ -937,6 +951,9 @@
937951
'match': '(?i)(?<=[,\\s"]|\\*/|^)\\d+x(?=[\\s,"\')]|/\\*|$)'
938952
'name': 'constant.numeric.other.density.css'
939953
}
954+
{
955+
'include': '#arithmetic-operators'
956+
}
940957
{
941958
'include': '#property-values'
942959
}
@@ -1050,6 +1067,30 @@
10501067
]
10511068
}
10521069
]
1070+
'function-nesting':
1071+
'patterns': [
1072+
{
1073+
'begin': '\\('
1074+
'beginCaptures':
1075+
'0':
1076+
'name': 'punctuation.definition.begin.bracket.round.scss'
1077+
'end': '\\)'
1078+
'endCaptures':
1079+
'0':
1080+
'name': 'punctuation.definition.end.bracket.round.scss'
1081+
'patterns': [
1082+
{
1083+
'include': '#arithmetic-operators'
1084+
}
1085+
{
1086+
'include': '#property-values'
1087+
},
1088+
{
1089+
'include': '#function-nesting'
1090+
}
1091+
]
1092+
}
1093+
]
10531094
'functional-pseudo-classes':
10541095
'patterns': [
10551096
{
@@ -1352,6 +1393,9 @@
13521393
{
13531394
'include': '#comment-block'
13541395
}
1396+
{
1397+
"include": "#functions"
1398+
}
13551399
]
13561400
}
13571401
]
@@ -1380,6 +1424,9 @@
13801424
)
13811425
(?=$|[{,\\s;]|/\\*)
13821426
'''
1427+
'nesting-selector':
1428+
'match': '&'
1429+
'name': 'entity.name.tag.nesting.selector.css'
13831430
'numeric-values':
13841431
'patterns': [
13851432
{
@@ -1686,6 +1733,9 @@
16861733
{
16871734
'include': '#rule-list-innards'
16881735
}
1736+
{
1737+
'include': '$self'
1738+
}
16891739
]
16901740
'rule-list-innards':
16911741
'patterns': [
@@ -1719,6 +1769,9 @@
17191769
}
17201770
]
17211771
}
1772+
{
1773+
'include': '#selector-innards'
1774+
}
17221775
{
17231776
'begin': '(:)\\s*'
17241777
'beginCaptures':
@@ -1833,7 +1886,7 @@
18331886
# Consists of a hyphen only
18341887
- # Terminated by either:
18351888
(?= $ # - End-of-line
1836-
| [\\s,.\\#)\\[:{>+~|] # - Followed by another selector
1889+
| [\\s,.\\#)\\[:{>+~|&] # - Followed by another selector
18371890
| /\\* # - Followed by a block comment
18381891
)
18391892
|
@@ -1843,7 +1896,7 @@
18431896
| \\\\(?:[0-9a-fA-F]{1,6}|.) # - Escape sequence
18441897
)*
18451898
(?: # Invalid punctuation
1846-
[!"'%&(*;<?@^`|\\]}] # - NOTE: We exempt `)` from the list of checked
1899+
[!"'%(*;<?@^`|\\]}] # - NOTE: We exempt `)` from the list of checked
18471900
| # symbols to avoid matching `:not(.invalid)`
18481901
/ (?!\\*) # - Avoid invalidating the start of a comment
18491902
)+
@@ -1874,7 +1927,7 @@
18741927
)+
18751928
) # Followed by either:
18761929
(?= $ # - End of the line
1877-
| [\\s,.\\#)\\[:{>+~|] # - Another selector
1930+
| [\\s,.\\#)\\[:{>+~|&] # - Another selector
18781931
| /\\* # - A block comment
18791932
)
18801933
'''
@@ -1897,7 +1950,7 @@
18971950
(?![0-9])
18981951
(?:[-a-zA-Z0-9_]|[^\\x00-\\x7F]|\\\\(?:[0-9a-fA-F]{1,6}|.))+
18991952
)
1900-
(?=$|[\\s,.\\#)\\[:{>+~|]|/\\*)
1953+
(?=$|[\\s,.\\#)\\[:{>+~|&]|/\\*)
19011954
'''
19021955
'name': 'entity.other.attribute-name.id.css'
19031956
}
@@ -2100,7 +2153,7 @@
21002153
| mrow|ms|mscarries|mscarry|msgroup|msline|mspace|msqrt|msrow|mstack|mstyle|msub|msubsup
21012154
| msup|mtable|mtd|mtext|mtr|munder|munderover|semantics
21022155
)
2103-
(?=[+~>\\s,.\\#|){:\\[]|/\\*|$)
2156+
(?=[+~>\\s,.\\#|&){:\\[]|/\\*|$)
21042157
'''
21052158
'name': 'entity.name.tag.css'
21062159
'unicode-range':

syntaxes/css.tmLanguage.json

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@
2424
},
2525
{
2626
"include": "#rule-list"
27+
},
28+
{
29+
"include": "#nesting-selector"
2730
}
2831
],
2932
"repository": {
33+
"arithmetic-operators": {
34+
"match": "[*/]|(?<=\\s|^)[-+](?=\\s|$)",
35+
"name": "keyword.operator.arithmetic.css"
36+
},
3037
"at-rules": {
3138
"patterns": [
3239
{
@@ -217,6 +224,9 @@
217224
},
218225
"name": "meta.at-rule.media.body.css",
219226
"patterns": [
227+
{
228+
"include": "#rule-list-innards"
229+
},
220230
{
221231
"include": "$self"
222232
}
@@ -660,6 +670,9 @@
660670
},
661671
"name": "meta.at-rule.body.css",
662672
"patterns": [
673+
{
674+
"include": "#rule-list-innards"
675+
},
663676
{
664677
"include": "$self"
665678
}
@@ -840,16 +853,18 @@
840853
"name": "meta.function.calc.css",
841854
"patterns": [
842855
{
843-
"match": "[*/]|(?<=\\s|^)[-+](?=\\s|$)",
844-
"name": "keyword.operator.arithmetic.css"
856+
"include": "#arithmetic-operators"
845857
},
846858
{
847859
"include": "#property-values"
860+
},
861+
{
862+
"include": "#function-nesting"
848863
}
849864
]
850865
},
851866
{
852-
"begin": "(?i)(?<![\\w-])(rgba?|rgb|hsla?|hsl|hwb|lab|oklab|lch|oklch|color)(\\()",
867+
"begin": "(?i)(?<![\\w-])(rgba?|rgb|hsla?|hsl|hwb|lab|oklab|lch|oklch|color|light-dark)(\\()",
853868
"beginCaptures": {
854869
"1": {
855870
"name": "support.function.misc.css"
@@ -965,6 +980,9 @@
965980
"match": "(?i)(?<=[,\\s\"]|\\*/|^)\\d+x(?=[\\s,\"')]|/\\*|$)",
966981
"name": "constant.numeric.other.density.css"
967982
},
983+
{
984+
"include": "#arithmetic-operators"
985+
},
968986
{
969987
"include": "#property-values"
970988
},
@@ -1082,6 +1100,35 @@
10821100
}
10831101
]
10841102
},
1103+
"function-nesting": {
1104+
"patterns": [
1105+
{
1106+
"begin": "\\(",
1107+
"beginCaptures": {
1108+
"0": {
1109+
"name": "punctuation.definition.begin.bracket.round.scss"
1110+
}
1111+
},
1112+
"end": "\\)",
1113+
"endCaptures": {
1114+
"0": {
1115+
"name": "punctuation.definition.end.bracket.round.scss"
1116+
}
1117+
},
1118+
"patterns": [
1119+
{
1120+
"include": "#arithmetic-operators"
1121+
},
1122+
{
1123+
"include": "#property-values"
1124+
},
1125+
{
1126+
"include": "#function-nesting"
1127+
}
1128+
]
1129+
}
1130+
]
1131+
},
10851132
"functional-pseudo-classes": {
10861133
"patterns": [
10871134
{
@@ -1347,6 +1394,9 @@
13471394
},
13481395
{
13491396
"include": "#comment-block"
1397+
},
1398+
{
1399+
"include": "#functions"
13501400
}
13511401
]
13521402
}
@@ -1372,6 +1422,10 @@
13721422
},
13731423
"match": "(?xi)\n(?<=^|\\s|,|\\*/)\n(?:\n # Valid media types\n (all|print|screen|speech)\n |\n # Deprecated in Media Queries 4: http://dev.w3.org/csswg/mediaqueries/#media-types\n (aural|braille|embossed|handheld|projection|tty|tv)\n)\n(?=$|[{,\\s;]|/\\*)"
13741424
},
1425+
"nesting-selector": {
1426+
"match": "&",
1427+
"name": "entity.name.tag.nesting.selector.css"
1428+
},
13751429
"numeric-values": {
13761430
"patterns": [
13771431
{
@@ -1505,6 +1559,9 @@
15051559
"patterns": [
15061560
{
15071561
"include": "#rule-list-innards"
1562+
},
1563+
{
1564+
"include": "$self"
15081565
}
15091566
]
15101567
},
@@ -1533,6 +1590,9 @@
15331590
}
15341591
]
15351592
},
1593+
{
1594+
"include": "#selector"
1595+
},
15361596
{
15371597
"begin": "(:)\\s*",
15381598
"beginCaptures": {
@@ -1617,7 +1677,7 @@
16171677
]
16181678
}
16191679
},
1620-
"match": "(?x) (?<![@\\w-])\n([.\\#])\n# Invalid identifier\n(\n (?:\n # Starts with ASCII digits, with possible hyphen preceding it\n -?[0-9]\n |\n # Consists of a hyphen only\n - # Terminated by either:\n (?= $ # - End-of-line\n | [\\s,.\\#)\\[:{>+~|] # - Followed by another selector\n | /\\* # - Followed by a block comment\n )\n |\n # Name contains unescaped ASCII symbol\n (?: # Check for acceptable preceding characters\n [-a-zA-Z_0-9]|[^\\x00-\\x7F] # - Valid selector character\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # - Escape sequence\n )*\n (?: # Invalid punctuation\n [!\"'%&(*;<?@^`|\\]}] # - NOTE: We exempt `)` from the list of checked\n | # symbols to avoid matching `:not(.invalid)`\n / (?!\\*) # - Avoid invalidating the start of a comment\n )+\n )\n # Mark remainder of selector invalid\n (?: [-a-zA-Z_0-9]|[^\\x00-\\x7F] # - Otherwise valid identifier characters\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # - Escape sequence\n )*\n)",
1680+
"match": "(?x) (?<![@\\w-])\n([.\\#])\n# Invalid identifier\n(\n (?:\n # Starts with ASCII digits, with possible hyphen preceding it\n -?[0-9]\n |\n # Consists of a hyphen only\n - # Terminated by either:\n (?= $ # - End-of-line\n | [\\s,.\\#)\\[:{>+~|&] # - Followed by another selector\n | /\\* # - Followed by a block comment\n )\n |\n # Name contains unescaped ASCII symbol\n (?: # Check for acceptable preceding characters\n [-a-zA-Z_0-9]|[^\\x00-\\x7F] # - Valid selector character\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # - Escape sequence\n )*\n (?: # Invalid punctuation\n [!\"'%(*;<?@^`|\\]}] # - NOTE: We exempt `)` from the list of checked\n | # symbols to avoid matching `:not(.invalid)`\n / (?!\\*) # - Avoid invalidating the start of a comment\n )+\n )\n # Mark remainder of selector invalid\n (?: [-a-zA-Z_0-9]|[^\\x00-\\x7F] # - Otherwise valid identifier characters\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # - Escape sequence\n )*\n)",
16211681
"name": "invalid.illegal.bad-identifier.css"
16221682
},
16231683
{
@@ -1633,7 +1693,7 @@
16331693
]
16341694
}
16351695
},
1636-
"match": "(?x)\n(\\.) # Valid class-name\n(\n (?: [-a-zA-Z_0-9]|[^\\x00-\\x7F] # Valid identifier characters\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # Escape sequence\n )+\n) # Followed by either:\n(?= $ # - End of the line\n | [\\s,.\\#)\\[:{>+~|] # - Another selector\n | /\\* # - A block comment\n)",
1696+
"match": "(?x)\n(\\.) # Valid class-name\n(\n (?: [-a-zA-Z_0-9]|[^\\x00-\\x7F] # Valid identifier characters\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # Escape sequence\n )+\n) # Followed by either:\n(?= $ # - End of the line\n | [\\s,.\\#)\\[:{>+~|&] # - Another selector\n | /\\* # - A block comment\n)",
16371697
"name": "entity.other.attribute-name.class.css"
16381698
},
16391699
{
@@ -1649,7 +1709,7 @@
16491709
]
16501710
}
16511711
},
1652-
"match": "(?x)\n(\\#)\n(\n -?\n (?![0-9])\n (?:[-a-zA-Z0-9_]|[^\\x00-\\x7F]|\\\\(?:[0-9a-fA-F]{1,6}|.))+\n)\n(?=$|[\\s,.\\#)\\[:{>+~|]|/\\*)",
1712+
"match": "(?x)\n(\\#)\n(\n -?\n (?![0-9])\n (?:[-a-zA-Z0-9_]|[^\\x00-\\x7F]|\\\\(?:[0-9a-fA-F]{1,6}|.))+\n)\n(?=$|[\\s,.\\#)\\[:{>+~|&]|/\\*)",
16531713
"name": "entity.other.attribute-name.id.css"
16541714
},
16551715
{
@@ -1813,7 +1873,7 @@
18131873
]
18141874
},
18151875
"tag-names": {
1816-
"match": "(?xi) (?<![\\w:-])\n(?:\n # HTML\n a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdi|bdo|bgsound\n | big|blink|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command\n | content|data|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|element|em|embed|fieldset\n | figcaption|figure|font|footer|form|frame|frameset|h[1-6]|head|header|hgroup|hr|html|i\n | iframe|image|img|input|ins|isindex|kbd|keygen|label|legend|li|link|listing|main|map|mark\n | marquee|math|menu|menuitem|meta|meter|multicol|nav|nextid|nobr|noembed|noframes|noscript\n | object|ol|optgroup|option|output|p|param|picture|plaintext|pre|progress|q|rb|rp|rt|rtc\n | ruby|s|samp|script|section|select|shadow|slot|small|source|spacer|span|strike|strong\n | style|sub|summary|sup|table|tbody|td|template|textarea|tfoot|th|thead|time|title|tr\n | track|tt|u|ul|var|video|wbr|xmp\n\n # SVG\n | altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|animateMotion|animateTransform\n | circle|clipPath|color-profile|cursor|defs|desc|discard|ellipse|feBlend|feColorMatrix\n | feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap\n | feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur\n | feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting\n | feSpotLight|feTile|feTurbulence|filter|font-face|font-face-format|font-face-name\n | font-face-src|font-face-uri|foreignObject|g|glyph|glyphRef|hatch|hatchpath|hkern\n | line|linearGradient|marker|mask|mesh|meshgradient|meshpatch|meshrow|metadata\n | missing-glyph|mpath|path|pattern|polygon|polyline|radialGradient|rect|set|solidcolor\n | stop|svg|switch|symbol|text|textPath|tref|tspan|use|view|vkern\n\n # MathML\n | annotation|annotation-xml|maction|maligngroup|malignmark|math|menclose|merror|mfenced\n | mfrac|mglyph|mi|mlabeledtr|mlongdiv|mmultiscripts|mn|mo|mover|mpadded|mphantom|mroot\n | mrow|ms|mscarries|mscarry|msgroup|msline|mspace|msqrt|msrow|mstack|mstyle|msub|msubsup\n | msup|mtable|mtd|mtext|mtr|munder|munderover|semantics\n)\n(?=[+~>\\s,.\\#|){:\\[]|/\\*|$)",
1876+
"match": "(?xi) (?<![\\w:-])\n(?:\n # HTML\n a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdi|bdo|bgsound\n | big|blink|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command\n | content|data|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|element|em|embed|fieldset\n | figcaption|figure|font|footer|form|frame|frameset|h[1-6]|head|header|hgroup|hr|html|i\n | iframe|image|img|input|ins|isindex|kbd|keygen|label|legend|li|link|listing|main|map|mark\n | marquee|math|menu|menuitem|meta|meter|multicol|nav|nextid|nobr|noembed|noframes|noscript\n | object|ol|optgroup|option|output|p|param|picture|plaintext|pre|progress|q|rb|rp|rt|rtc\n | ruby|s|samp|script|section|select|shadow|slot|small|source|spacer|span|strike|strong\n | style|sub|summary|sup|table|tbody|td|template|textarea|tfoot|th|thead|time|title|tr\n | track|tt|u|ul|var|video|wbr|xmp\n\n # SVG\n | altGlyph|altGlyphDef|altGlyphItem|animate|animateColor|animateMotion|animateTransform\n | circle|clipPath|color-profile|cursor|defs|desc|discard|ellipse|feBlend|feColorMatrix\n | feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap\n | feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur\n | feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting\n | feSpotLight|feTile|feTurbulence|filter|font-face|font-face-format|font-face-name\n | font-face-src|font-face-uri|foreignObject|g|glyph|glyphRef|hatch|hatchpath|hkern\n | line|linearGradient|marker|mask|mesh|meshgradient|meshpatch|meshrow|metadata\n | missing-glyph|mpath|path|pattern|polygon|polyline|radialGradient|rect|set|solidcolor\n | stop|svg|switch|symbol|text|textPath|tref|tspan|use|view|vkern\n\n # MathML\n | annotation|annotation-xml|maction|maligngroup|malignmark|math|menclose|merror|mfenced\n | mfrac|mglyph|mi|mlabeledtr|mlongdiv|mmultiscripts|mn|mo|mover|mpadded|mphantom|mroot\n | mrow|ms|mscarries|mscarry|msgroup|msline|mspace|msqrt|msrow|mstack|mstyle|msub|msubsup\n | msup|mtable|mtd|mtext|mtr|munder|munderover|semantics\n)\n(?=[+~>\\s,.\\#|&){:\\[]|/\\*|$)",
18171877
"name": "entity.name.tag.css"
18181878
},
18191879
"unicode-range": {

0 commit comments

Comments
 (0)