From cf20d5fbe89b6cc50036c0f3f4f64c1200b78d65 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sun, 10 Mar 2024 18:46:01 +0100 Subject: [PATCH] Improve constants interpolation support --- Syntaxes/SCSS.sublime-syntax | 11 +++++++---- Tests/syntax_test_css.scss | 7 +++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Syntaxes/SCSS.sublime-syntax b/Syntaxes/SCSS.sublime-syntax index d65f7aa0..1951e3f4 100644 --- a/Syntaxes/SCSS.sublime-syntax +++ b/Syntaxes/SCSS.sublime-syntax @@ -26,8 +26,8 @@ variables: tag_name_begin: (?=[[:alpha:]]|#{) - lang_range_begin: (?={{nmstart}}|\*|#{) - unquoted_url_begin: (?=[[:alnum:]/]|#{) + lang_range_begin: (?={{ident_start}}|\*) + unquoted_url_begin: (?={{ident_start}}|/) # SCSS variables @@ -443,9 +443,12 @@ contexts: - meta_include_prototype: false - meta_scope: meta.string.css string.unquoted.css - include: scss-string-interpolations - - match: '{{break}}(?!\s+{{ident_start}})' + # allow unquoted space separated font names + - match: (?!\s+{{ident_start}}){{break}} + pop: 1 + # function call ahead, skip font name + - match: (?=\s+{{ident}}\() pop: 1 - # consume unicode escapes and possibly following whitespace - match: '{{unicode}}' language-ranges: diff --git a/Tests/syntax_test_css.scss b/Tests/syntax_test_css.scss index 86386f51..4d5ab738 100644 --- a/Tests/syntax_test_css.scss +++ b/Tests/syntax_test_css.scss @@ -2634,6 +2634,13 @@ font: sans serif; /* ^^^^^^^^^^ meta.string.css string.unquoted.css */ + font: san\73 -\73 erif; +/* ^^^^^^^^^^^^^^^^ meta.string.css string.unquoted.css */ + + font: sans serif var(--name); +/* ^^^^^^^^^^ meta.string.css string.unquoted.css */ +/* ^^^^^^^^^^^ meta.function-call */ + font: inherit; /* ^^^^^^^ support - string */