Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSS] Add support for at-scope rule #3869

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions CSS/CSS.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ contexts:
- include: at-page
- include: at-page-margin
- include: at-property
- include: at-scope
- include: at-scroll-timeline
- include: at-other

Expand All @@ -406,6 +407,7 @@ contexts:
- include: at-page
- include: at-page-margin
- include: at-property
- include: at-scope
- include: at-scroll-timeline
- include: at-other

Expand Down Expand Up @@ -892,6 +894,50 @@ contexts:
- include: comments
- include: else-pop

###[ SCOPE AT-RULE ]###########################################################

# @scope
# https://developer.mozilla.org/en-US/docs/Web/CSS/@scope
at-scope:
- match: (@)(?i:scope){{break}}
scope: keyword.control.directive.css
captures:
1: punctuation.definition.keyword.css
push:
- at-scope-selector-meta
- maybe-property-list
- at-scope-selector-to
- at-scope-selector-group

at-scope-selector-meta:
- meta_include_prototype: false
- meta_scope: meta.at-rule.scope.css
- include: immediately-pop

at-scope-selector-to:
- meta_include_prototype: false
- match: to{{break}}
scope: keyword.other.css
set: at-scope-selector-group
- include: comments
- include: else-pop

at-scope-selector-group:
- meta_include_prototype: false
- match: \(
scope: punctuation.section.group.begin.css
set: at-scope-selector-group-body
- include: comments
- include: else-pop

at-scope-selector-group-body:
- meta_scope: meta.group.css
- meta_content_scope: meta.selector.css
- match: \)
scope: punctuation.section.group.end.css
pop: 1
- include: selector-body

###[ SCROLL-TIMELINE AT-RULE ]#################################################

# @scroll-timeline
Expand Down
85 changes: 85 additions & 0 deletions CSS/syntax_test_css.css
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,91 @@
/* ^ punctuation.terminator.rule.css */
}

@scope
/* ^^^^^^ meta.at-rule.scope.css keyword.control.directive.css */

@scope {}
/* ^^^^^^^^^ meta.at-rule.scope.css */
/* ^^^^^^ keyword.control.directive.css */
/* ^^ meta.property-list.css meta.block.css */

@scope to ;
/* ^^^^^^^^^^ meta.at-rule.scope.css */
/* ^^^^^^ keyword.control.directive.css */
/* ^^ keyword.other.css */
/* ^ punctuation.terminator.rule.css */

@scope () {}
/* ^^^^^^^^^^^^ meta.at-rule.scope.css */
/* ^^^^^^ keyword.control.directive.css */
/* ^^ meta.group.css */
/* ^^ meta.property-list.css meta.block.css */

@scope () () {}
/* ^^^^^^^^^^ meta.at-rule.scope.css */
/* ^^^^^ - meta.at-rule */
/* ^^^^^^ keyword.control.directive.css */
/* ^^ meta.group.css */
/* ^^ invalid.illegal.unexpected-token.css */
/* ^^ meta.property-list.css meta.block.css */

@scope () to () {}
/* ^^^^^^^^^^^^^^^^^^ meta.at-rule.scope.css */
/* ^^ meta.group.css */
/* ^^ meta.group.css */
/* ^^ meta.property-list.css meta.block.css */
/* ^ punctuation.definition.keyword.css */
/* ^^^^^^ keyword.control.directive.css */
/* ^ punctuation.section.group.begin.css */
/* ^ punctuation.section.group.end.css */
/* ^^ keyword.other.css */
/* ^ punctuation.section.group.begin.css */
/* ^ punctuation.section.group.end.css */
/* ^ punctuation.section.block.begin.css */
/* ^ punctuation.section.block.end.css */

@scope /**/ () /**/ to /**/ () /**/ {}
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.scope.css */
/* ^^ meta.group.css */
/* ^^ meta.group.css */
/* ^^ meta.property-list.css meta.block.css */
/* ^ punctuation.definition.keyword.css */
/* ^^^^^^ keyword.control.directive.css */
/* ^^^^ comment.block.css */
/* ^ punctuation.section.group.begin.css */
/* ^ punctuation.section.group.end.css */
/* ^^^^ comment.block.css */
/* ^^ keyword.other.css */
/* ^^^^ comment.block.css */
/* ^ punctuation.section.group.begin.css */
/* ^ punctuation.section.group.end.css */
/* ^^^^ comment.block.css */
/* ^ punctuation.section.block.begin.css */
/* ^ punctuation.section.block.end.css */

@scope (.class) to (.limit > *) {}
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.scope.css */
/* ^ meta.group.css - meta.selector */
/* ^^^^^^ meta.at-rule.scope.css meta.group.css meta.selector.css */
/* ^ meta.group.css - meta.selector */
/* ^ meta.group.css - meta.selector */
/* ^^^^^^^^^^ meta.at-rule.scope.css meta.group.css meta.selector.css */
/* ^ meta.group.css - meta.selector */
/* ^^ meta.property-list.css meta.block.css */
/* ^ punctuation.definition.keyword.css */
/* ^^^^^^ keyword.control.directive.css */
/* ^ punctuation.section.group.begin.css */
/* ^^^^^^ entity.other.attribute-name.class.css */
/* ^ punctuation.section.group.end.css */
/* ^^ keyword.other.css */
/* ^ punctuation.section.group.begin.css */
/* ^^^^^^ entity.other.attribute-name.class.css */
/* ^ keyword.operator.combinator.css */
/* ^ constant.other.wildcard.asterisk.css */
/* ^ punctuation.section.group.end.css */
/* ^ punctuation.section.block.begin.css */
/* ^ punctuation.section.block.end.css */

@scroll-timeline
/* ^^^^^^^^^^^^^^^^^ meta.at-rule.scroll-timeline.css */
/* ^ keyword.control.directive.css punctuation.definition.keyword.css */
Expand Down
Loading