diff --git a/Snippets/component.sublime-snippet b/Snippets/component.sublime-snippet index 2f8b516..3f58c1f 100644 --- a/Snippets/component.sublime-snippet +++ b/Snippets/component.sublime-snippet @@ -6,6 +6,6 @@ $1 $0 ]]> component - text.html.astro + source.astro Component diff --git a/Snippets/page_html.sublime-snippet b/Snippets/page_html.sublime-snippet index f457b1b..f8b334f 100644 --- a/Snippets/page_html.sublime-snippet +++ b/Snippets/page_html.sublime-snippet @@ -16,6 +16,6 @@ $1 ]]> page_html - text.html.astro + source.astro Page with full HTML diff --git a/Snippets/page_layout.sublime-snippet b/Snippets/page_layout.sublime-snippet index b8a5776..dbae2f9 100644 --- a/Snippets/page_layout.sublime-snippet +++ b/Snippets/page_layout.sublime-snippet @@ -8,6 +8,6 @@ import ${1:Layout} from "../layouts/$1.astro" ]]> page_layout - text.html.astro + source.astro Page from Layout diff --git a/Syntaxes/HTML (Astro).sublime-syntax b/Syntaxes/HTML (Astro).sublime-syntax index 20ddd9f..adf7376 100644 --- a/Syntaxes/HTML (Astro).sublime-syntax +++ b/Syntaxes/HTML (Astro).sublime-syntax @@ -221,6 +221,11 @@ contexts: - include: style-lang-decider style-lang-decider: + - match: (?i)(?=postcss{{unquoted_attribute_break}}|'postcss'|"postcss") + set: + - style-postcss + - tag-generic-attribute-meta + - tag-generic-attribute-value - match: (?i)(?=css{{unquoted_attribute_break}}|\'css\'|"css") set: - style-css @@ -273,6 +278,27 @@ contexts: 3: source.less.embedded.html 4: comment.block.html punctuation.definition.comment.end.html + style-postcss: + - meta_scope: meta.tag.style.begin.html + - match: '>' + scope: punctuation.definition.tag.end.html + set: style-postcss-content + - include: style-common + + style-postcss-content: + - match: '{{style_content_begin}}' + captures: + 1: comment.block.html punctuation.definition.comment.begin.html + pop: 1 + embed: scope:source.postcss + embed_scope: source.postcss.embedded.html + escape: '{{style_content_end}}' + escape_captures: + 1: source.postcss.embedded.html + 2: comment.block.html punctuation.definition.comment.end.html + 3: source.postcss.embedded.html + 4: comment.block.html punctuation.definition.comment.end.html + style-sass: - meta_scope: meta.tag.style.begin.html - match: '>' diff --git a/tests/syntax_test_style.astro b/tests/syntax_test_style.astro index 350bd37..57d3ae7 100644 --- a/tests/syntax_test_style.astro +++ b/tests/syntax_test_style.astro @@ -170,6 +170,22 @@ // ^^^^^ entity.name.tag.style.html // ^ punctuation.definition.tag.end.html + +// <- - source.postcss - comment - meta.tag +//^^ - source.postcss - comment - meta.tag +// ^^^^^^^^ meta.tag - source.postcss +// ^^ punctuation.definition.tag.begin.html +// ^^^^^ entity.name.tag.style.html +// ^ punctuation.definition.tag.end.html