From 9d7a7beccd9a6a2c20aa99156df34f7d9a17f100 Mon Sep 17 00:00:00 2001 From: Koen Lagveen Date: Sun, 4 Feb 2024 20:06:33 +0100 Subject: [PATCH] add use and forward --- Syntaxes/SCSS.sublime-syntax | 5 ++- Tests/syntax_test_scss.scss | 76 ++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/Syntaxes/SCSS.sublime-syntax b/Syntaxes/SCSS.sublime-syntax index 1b355c3d..72846632 100644 --- a/Syntaxes/SCSS.sublime-syntax +++ b/Syntaxes/SCSS.sublime-syntax @@ -397,6 +397,7 @@ contexts: push: - include: terminator-pop - include: comments + - include: comma-delimiters - include: scss-expression - match: '{{ident}}' scope: meta.generic-name.scss @@ -408,9 +409,9 @@ contexts: - match: '\)' scope: punctuation.section.group.end.scss pop: 1 - - match: ':' - scope: punctuation.separator.key-value.css - include: comments + - include: comma-delimiters + - include: scss-declaration - include: scss-expression - include: comments - include: quoted-strings diff --git a/Tests/syntax_test_scss.scss b/Tests/syntax_test_scss.scss index 494000e7..53ef0fee 100644 --- a/Tests/syntax_test_scss.scss +++ b/Tests/syntax_test_scss.scss @@ -407,3 +407,79 @@ $variable: first global value; animation-duration: $duration; animation-iteration-count: infinite; } + +//============================================================================= +// At-Rules: use +// https://sass-lang.com/documentation/at-rules/use/ +//============================================================================= +@use 'foundation/code'; +@use 'foundation/lists'; +//^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.module.scss +//^^ keyword.control.directive.module.scss +//<- punctuation.definition.keyword.scss +//. ^^^^^^^^^^^^^^^^^ meta.string.css + +// https://sass-lang.com/documentation/at-rules/use/#choosing-a-namespace +@use "src/corners" as c; +//^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.module.scss +//^^ keyword.control.directive.module.scss +//<- punctuation.definition.keyword.scss +// ^^ keyword.control.as.scss +// ^ meta.generic-name.scss + +// https://sass-lang.com/documentation/at-rules/use/#configuration +@use 'library' with ( +//^^^^^^^^^^^^^^^^^^^^ meta.at-rule.module.scss +//^^ keyword.control.directive.module.scss +//<- punctuation.definition.keyword.scss +// ^^^^ keyword.control.with.scss +// ^ punctuation.section.group.begin.scss + $black: #222, +//^^^^^^ variable.declaration.scss +// ^^^^ constant.other.color +// ^ punctuation.separator.sequence.css + +// TODO: $border-radius should be a declaration? +// maybe everything in () should be considered a map? or args? + $border-radius: 0.1rem, + $border-radius: 0.1rem +//^^^^^^^^^^^^^^ variable +); + +//============================================================================= +// At-Rules: forward +// https://sass-lang.com/documentation/at-rules/forward/ +//============================================================================= +@forward "src/list"; +//^^^^^^^^^^^^^^^^^ meta.at-rule.module.scss +//^^^^^^ keyword.control.directive.module.scss +//<- punctuation.definition.keyword.scss + +// https://sass-lang.com/documentation/at-rules/forward/#adding-a-prefix +@forward "src/list" as list-*; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.module.scss +//^^^^^^ keyword.control.directive.module.scss +//<- punctuation.definition.keyword.scss +// ^^ keyword.control.as.scss +// ^^ meta.generic-name.scss +// ^ constant.language.import-all.scss +// ^ punctuation.terminator.rule.css + +// https://sass-lang.com/documentation/at-rules/forward/#controlling-visibility +@forward "src/list" hide list-reset, $horizontal-list-gap; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.module.scss +//^^^^^^ keyword.control.directive.module.scss +//<- punctuation.definition.keyword.scss +// ^^^^ keyword.control.show-hide.scss +// ^^^^^^^^^^ meta.generic-name.scss +// ^ punctuation.separator.sequence.css +// ^^^^^^^^^^^^^^^^^^^^ variable.other.scss +// ^ punctuation.terminator.rule.css + +// https://sass-lang.com/documentation/at-rules/forward/#configuring-modules +@forward 'library' with ( + $black: #222 !default, +// ^^^^^^^^ keyword.other.default.scss +// ^ punctuation.separator.sequence.css + $border-radius: 0.1rem !default +);