Skip to content

Commit 047402e

Browse files
author
DeathAxe
committed
[CSS] Add support for at-scope rule
Resolves sublimehq#3867 This commit implements support for @scope rules. see: https://developer.mozilla.org/en-US/docs/Web/CSS/@scope
1 parent 40d269d commit 047402e

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

CSS/CSS.sublime-syntax

+28
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ contexts:
387387
- include: at-page
388388
- include: at-page-margin
389389
- include: at-property
390+
- include: at-scope
390391
- include: at-scroll-timeline
391392
- include: at-other
392393

@@ -406,6 +407,7 @@ contexts:
406407
- include: at-page
407408
- include: at-page-margin
408409
- include: at-property
410+
- include: at-scope
409411
- include: at-scroll-timeline
410412
- include: at-other
411413

@@ -892,6 +894,32 @@ contexts:
892894
- include: comments
893895
- include: else-pop
894896

897+
###[ SCROPE AT-RULE ]##########################################################
898+
899+
at-scope:
900+
- match: (@)(?i:scope){{break}}
901+
scope: keyword.control.directive.css
902+
captures:
903+
1: punctuation.definition.keyword.css
904+
push: at-scope-selector
905+
906+
at-scope-selector:
907+
- meta_scope: meta.at-rule.scope.css
908+
- match: \(
909+
scope: punctuation.section.group.begin.css
910+
push: at-scope-selector-group-body
911+
- match: to{{break}}
912+
scope: keyword.other.css
913+
- include: else-pop
914+
915+
at-scope-selector-group-body:
916+
- meta_scope: meta.group.css
917+
- meta_content_scope: meta.selector.css
918+
- match: \)
919+
scope: punctuation.section.group.end.css
920+
pop: 1
921+
- include: selector-body
922+
895923
###[ SCROLL-TIMELINE AT-RULE ]#################################################
896924

897925
# @scroll-timeline

CSS/syntax_test_css.css

+47
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,53 @@
15541554
/* ^ punctuation.terminator.rule.css */
15551555
}
15561556

1557+
@scope
1558+
/* ^^^^^^ meta.at-rule.scope.css keyword.control.directive.css */
1559+
1560+
@scope to ;
1561+
/* ^^^^^^^^^^ meta.at-rule.scope.css */
1562+
/* ^^^^^^ keyword.control.directive.css */
1563+
/* ^^ keyword.other.css */
1564+
/* ^ punctuation.terminator.rule.css */
1565+
1566+
@scope () to () {}
1567+
/* ^^^^^^^^^^^^^^^^ meta.at-rule.scope.css */
1568+
/* ^^ meta.group.css */
1569+
/* ^^ meta.group.css */
1570+
/* ^^ meta.property-list.css meta.block.css */
1571+
/* ^ punctuation.definition.keyword.css */
1572+
/* ^^^^^^ keyword.control.directive.css */
1573+
/* ^ punctuation.section.group.begin.css */
1574+
/* ^ punctuation.section.group.end.css */
1575+
/* ^^ keyword.other.css */
1576+
/* ^ punctuation.section.group.begin.css */
1577+
/* ^ punctuation.section.group.end.css */
1578+
/* ^ punctuation.section.block.begin.css */
1579+
/* ^ punctuation.section.block.end.css */
1580+
1581+
@scope (.class) to (.limit > *) {}
1582+
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.scope.css */
1583+
/* ^ meta.group.css - meta.selector */
1584+
/* ^^^^^^ meta.at-rule.scope.css meta.group.css meta.selector.css */
1585+
/* ^ meta.group.css - meta.selector */
1586+
/* ^ meta.group.css - meta.selector */
1587+
/* ^^^^^^^^^^ meta.at-rule.scope.css meta.group.css meta.selector.css */
1588+
/* ^ meta.group.css - meta.selector */
1589+
/* ^^ meta.property-list.css meta.block.css */
1590+
/* ^ punctuation.definition.keyword.css */
1591+
/* ^^^^^^ keyword.control.directive.css */
1592+
/* ^ punctuation.section.group.begin.css */
1593+
/* ^^^^^^ entity.other.attribute-name.class.css */
1594+
/* ^ punctuation.section.group.end.css */
1595+
/* ^^ keyword.other.css */
1596+
/* ^ punctuation.section.group.begin.css */
1597+
/* ^^^^^^ entity.other.attribute-name.class.css */
1598+
/* ^ keyword.operator.combinator.css */
1599+
/* ^ constant.other.wildcard.asterisk.css */
1600+
/* ^ punctuation.section.group.end.css */
1601+
/* ^ punctuation.section.block.begin.css */
1602+
/* ^ punctuation.section.block.end.css */
1603+
15571604
@scroll-timeline
15581605
/* ^^^^^^^^^^^^^^^^^ meta.at-rule.scroll-timeline.css */
15591606
/* ^ keyword.control.directive.css punctuation.definition.keyword.css */

0 commit comments

Comments
 (0)