From 08980038db63eaf9d4cc8430fe8c6abc713c44d9 Mon Sep 17 00:00:00 2001 From: Will Rowe Date: Fri, 4 Oct 2024 22:35:09 -0400 Subject: [PATCH 1/4] Add tests --- .../syntax/tests/syntax_test_css.css.twig | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 resources/syntax/tests/syntax_test_css.css.twig diff --git a/resources/syntax/tests/syntax_test_css.css.twig b/resources/syntax/tests/syntax_test_css.css.twig new file mode 100644 index 0000000..a827cb3 --- /dev/null +++ b/resources/syntax/tests/syntax_test_css.css.twig @@ -0,0 +1,22 @@ +/* SYNTAX TEST "Packages/Twig/resources/syntax/CSS (Twig).sublime-syntax" */ + +/* Expression */ + div { +/* ^^^ meta.selector.css */ +/* ^ punctuation.section.block.begin.css */ + color: {{ blue|escape }} {# a comment #}; +/* ^^^^^^^^^^^^^^^^^ meta.expression.twig */ +/* ^^^^^^^^^^^^^^^^^ - meta.property-list.css */ +/* ^^^^^^^^^^^^^^^^^ - meta.property-value.css */ +/* ^^^^^^^^^^^^^^^ comment.block.twig */ + } +/* ^ punctuation.section.block.end.css */ + +/* Statement */ + div { + {% block style %}{% endblock %} +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.twig */ + + font-size: 24px; +/* ^^^^^^^^^ meta.property-name.css */ + } From 7c904d871cee8643d304e4995bc24e597b3af1d4 Mon Sep 17 00:00:00 2001 From: Will Rowe Date: Fri, 4 Oct 2024 20:53:09 -0400 Subject: [PATCH 2/4] Ensure that includes are set on top level contexts - The CSS syntax does not include prototype for most top level contexts. --- resources/syntax/CSS (Twig).sublime-syntax | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/resources/syntax/CSS (Twig).sublime-syntax b/resources/syntax/CSS (Twig).sublime-syntax index b9752c9..b8acd3d 100644 --- a/resources/syntax/CSS (Twig).sublime-syntax +++ b/resources/syntax/CSS (Twig).sublime-syntax @@ -16,6 +16,17 @@ contexts: - include: Twig.sublime-syntax#twig_embedded - include: Twig.sublime-syntax#comment + main: + - meta_prepend: true + - meta_include_prototype: false + - include: Twig.sublime-syntax#twig_embedded + - include: Twig.sublime-syntax#comment + + block-end: + - meta_append: true + - include: Twig.sublime-syntax#twig_embedded + - include: Twig.sublime-syntax#comment + string-content: - meta_prepend: true - include: Twig.sublime-syntax#twig_embedded From a9c3b268ba7d736efe7779948ff293e570a5ed38 Mon Sep 17 00:00:00 2001 From: Will Rowe Date: Mon, 7 Oct 2024 12:06:18 -0400 Subject: [PATCH 3/4] Include compatibility for older builds Co-authored-by: deathaxe --- resources/syntax/CSS (Twig).sublime-syntax | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/syntax/CSS (Twig).sublime-syntax b/resources/syntax/CSS (Twig).sublime-syntax index b8acd3d..001575d 100644 --- a/resources/syntax/CSS (Twig).sublime-syntax +++ b/resources/syntax/CSS (Twig).sublime-syntax @@ -27,6 +27,12 @@ contexts: - include: Twig.sublime-syntax#twig_embedded - include: Twig.sublime-syntax#comment + at-rule-block-body: + # required until ST4173 + - meta_prepend: true + - meta_include_prototype: false + - include: Twig.sublime-syntax#twig_embedded + - include: Twig.sublime-syntax#comment string-content: - meta_prepend: true - include: Twig.sublime-syntax#twig_embedded From c4bfa9351dccd86d2985658c64be44964520e731 Mon Sep 17 00:00:00 2001 From: Will Rowe Date: Mon, 7 Oct 2024 15:09:42 -0400 Subject: [PATCH 4/4] Add missing empty line Co-authored-by: deathaxe --- resources/syntax/CSS (Twig).sublime-syntax | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/syntax/CSS (Twig).sublime-syntax b/resources/syntax/CSS (Twig).sublime-syntax index 001575d..a1ed49f 100644 --- a/resources/syntax/CSS (Twig).sublime-syntax +++ b/resources/syntax/CSS (Twig).sublime-syntax @@ -33,6 +33,7 @@ contexts: - meta_include_prototype: false - include: Twig.sublime-syntax#twig_embedded - include: Twig.sublime-syntax#comment + string-content: - meta_prepend: true - include: Twig.sublime-syntax#twig_embedded