Skip to content

Commit 26b7b86

Browse files
committed
Layer working
1 parent da7b89b commit 26b7b86

File tree

1 file changed

+205
-1
lines changed

1 file changed

+205
-1
lines changed

src/vscode-css/grammars/css.cson

Lines changed: 205 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,20 @@
198198
'include': '#url'
199199
}
200200
{
201-
'include': '#media-query-list'
201+
'begin': '\\s+'
202+
'end': '(?=;)'
203+
'name': 'import.inner'
204+
'patterns': [
205+
{
206+
'include': '#layer-function'
207+
}
208+
# {
209+
# 'include': '#supports-function'
210+
# }
211+
# {
212+
# 'include': '#media-query-list'
213+
# }
214+
]
202215
}
203216
]
204217
}
@@ -1695,6 +1708,42 @@
16951708
]
16961709
}
16971710
]
1711+
'layer-function':
1712+
'patterns': [
1713+
{
1714+
# Match "layer" keyword
1715+
'match': '''(?xi)
1716+
(?<!layer.*) # Only one "layer" keyword is allowed per import
1717+
layer
1718+
(?=\\s|;) # Keyword must end with a whitespace or semicolon
1719+
'''
1720+
'name': 'support.constant.import.css'
1721+
}
1722+
{
1723+
# Match "layer()" function
1724+
'begin': '''(?xi)
1725+
(?<!layer[\\s\\(].*) # Only one "layer" keyword or function is allowed per import
1726+
(layer)(\\()
1727+
'''
1728+
'beginCaptures':
1729+
'1':
1730+
'name': 'support.function.layer.css'
1731+
'2':
1732+
'name': 'punctuation.section.layer.begin.bracket.round.css'
1733+
'end': '\\)'
1734+
'endCaptures':
1735+
'0':
1736+
'name': 'punctuation.section.layer.end.bracket.round.css'
1737+
'name': 'meta.function.layer.css'
1738+
'patterns': [
1739+
{
1740+
'begin': '(?<=\\(\\s*)[\\w\\-\\.]*'
1741+
'end': '(?=\\s|\\))'
1742+
'name': 'variable.parameter.layer.css'
1743+
}
1744+
]
1745+
}
1746+
]
16981747
'media-features':
16991748
'captures':
17001749
'1':
@@ -2810,6 +2859,161 @@
28102859
]
28112860
}
28122861
]
2862+
2863+
'supports-function':
2864+
'match': '.*supports\\('
2865+
'name': 'test.body'
2866+
# 'patterns': [
2867+
# {
2868+
# 'match': '.*supports\\('
2869+
# 'name': 'test.body'
2870+
# }
2871+
# ]
2872+
# # Match "layer()" function
2873+
# 'begin': '''(?xi)
2874+
# (?<!supports\\(.*)? # Only one "supports" function is allowed per import
2875+
# .*(supports)(\\()
2876+
# '''
2877+
# 'beginCaptures':
2878+
# '1':
2879+
# 'name': 'support.function.supports.css'
2880+
# '2':
2881+
# 'name': 'punctuation.section.supports.begin.bracket.round.css'
2882+
# 'end': '\\)'
2883+
# 'endCaptures':
2884+
# '0':
2885+
# 'name': 'punctuation.section.supports.end.bracket.round.css'
2886+
# 'name': 'meta.function.supports.css'
2887+
# 'patterns': [
2888+
# {
2889+
# 'begin': '(?<=\\(\\s*)[\\w\\-\\.]*'
2890+
# 'end': '(?=\\s|\\))'
2891+
# 'name': 'variable.parameter.supports.css'
2892+
# }
2893+
# ]
2894+
2895+
2896+
2897+
2898+
# # {
2899+
# # # Rules for <container scroll-state queries>
2900+
# # 'begin': '(?<=\\s)(scroll-state)(\\()'
2901+
# # 'beginCaptures':
2902+
# # '1':
2903+
# # 'name': 'support.query-name.container.css'
2904+
# # '2':
2905+
# # 'name': 'punctuation.definition.parameters.begin.bracket.round.css'
2906+
# # 'end': '\\)'
2907+
# # 'endCaptures':
2908+
# # '0':
2909+
# # 'name': 'punctuation.definition.parameters.end.bracket.round.css'
2910+
# # 'patterns': [
2911+
# # {
2912+
# # 'include': '#comment-block'
2913+
# # }
2914+
# # {
2915+
# # 'match': ':'
2916+
# # 'name': 'punctuation.separator.key-value.css'
2917+
# # }
2918+
# # {
2919+
# # # Scroll-state container descriptors names
2920+
# # 'match': '(?:scrollable|snapped|stuck)(?=\\s*\\:)'
2921+
# # 'name': 'support.type.property-name.container.css'
2922+
# # }
2923+
# # {
2924+
# # # Scroll-state container descriptors values
2925+
# # 'match': '''(?xi)
2926+
# # (?:
2927+
# # (?<=(scrollable|snapped|stuck)\\s*\\:\\s*)
2928+
# # (?:none)
2929+
# # )
2930+
# # | (?:
2931+
# # (?<=(scrollable|snapped)\\s*\\:\\s*)
2932+
# # (?:
2933+
# # x
2934+
# # | y
2935+
# # | block
2936+
# # | inline
2937+
# # )
2938+
# # )
2939+
# # | (?:
2940+
# # (?<=(scrollable|stuck)\\s*\\:\\s*)
2941+
# # (?:
2942+
# # top
2943+
# # | right
2944+
# # | bottom
2945+
# # | left
2946+
# # | block-start
2947+
# # | block-end
2948+
# # | inline-start
2949+
# # | inline-end
2950+
# # )
2951+
# # )
2952+
# # | (?:
2953+
# # (?<=(snapped)\\s*\\:\\s*)
2954+
# # (?:both)
2955+
# # )
2956+
# # '''
2957+
# # 'name': 'support.constant.property-value.css'
2958+
# # }
2959+
# # ]
2960+
# # }
2961+
# 'supports-function':
2962+
# 'begin': '(?xi)(?: \\s|\\G|^|(?<= ^|\\G|$) )(supports)(\\()'
2963+
# # 'begin': '(?:.*)(supports)(\\()'
2964+
# 'beginCaptures':
2965+
# # '1':
2966+
# # 'name': 'support.function.supports.css'
2967+
# '2':
2968+
# 'name': 'punctuation.section.supports.begin.bracket.round.css'
2969+
# 'end': '\\)'
2970+
# 'endCaptures':
2971+
# '0':
2972+
# 'name': 'punctuation.section.supports.end.bracket.round.css'
2973+
# 'name': 'meta.function.supports.css'
2974+
# 'patterns': [
2975+
# # {
2976+
# # 'include': '#shared-names'
2977+
# # }
2978+
# # {
2979+
# # 'include': '#property-names'
2980+
# # }
2981+
# # {
2982+
# # 'include': '#selector'
2983+
# # }
2984+
# # {
2985+
# # 'begin': '(?<![-a-zA-Z])(?=[-a-zA-Z])'
2986+
# # 'end': '$|(?![-a-zA-Z])'
2987+
# # 'name': 'meta.property-name.css'
2988+
# # }
2989+
# # {
2990+
# # 'begin': '(:)\\s*'
2991+
# # 'beginCaptures':
2992+
# # '1':
2993+
# # 'name': 'punctuation.separator.key-value.css'
2994+
# # 'end': '\\s*(;)|\\s*(?=}|\\))'
2995+
# # 'endCaptures':
2996+
# # '1':
2997+
# # 'name': 'punctuation.terminator.rule.css'
2998+
# # 'contentName': 'meta.property-value.css'
2999+
# # 'patterns': [
3000+
# # {
3001+
# # 'include': '#comment-block'
3002+
# # }
3003+
# # {
3004+
# # 'include': '#property-values'
3005+
# # }
3006+
# # ]
3007+
# # }
3008+
# # {
3009+
# # 'match': ';'
3010+
# # 'name': 'punctuation.terminator.rule.css'
3011+
# # }
3012+
# # {
3013+
# # 'match': '[\\w\\-\\.]*'
3014+
# # 'name': 'variable.parameter.supports.css'
3015+
# # }
3016+
# ]
28133017
'tag-names':
28143018
'match': '''(?xi) (?<![\\w:-])
28153019
(?:

0 commit comments

Comments
 (0)