Skip to content

Commit

Permalink
Merge branch 'st4126'
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Oct 4, 2024
2 parents b45a693 + 172ec66 commit 0ce16ee
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Snippets/component.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ $1
$0
]]></content>
<tabTrigger>component</tabTrigger>
<scope>text.html.astro</scope>
<scope>source.astro</scope>
<description>Component</description>
</snippet>
2 changes: 1 addition & 1 deletion Snippets/page_html.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ $1
</html>
]]></content>
<tabTrigger>page_html</tabTrigger>
<scope>text.html.astro</scope>
<scope>source.astro</scope>
<description>Page with full HTML</description>
</snippet>
2 changes: 1 addition & 1 deletion Snippets/page_layout.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import ${1:Layout} from "../layouts/$1.astro"
</$1>
]]></content>
<tabTrigger>page_layout</tabTrigger>
<scope>text.html.astro</scope>
<scope>source.astro</scope>
<description>Page from Layout</description>
</snippet>
26 changes: 26 additions & 0 deletions Syntaxes/HTML (Astro).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: '>'
Expand Down
16 changes: 16 additions & 0 deletions tests/syntax_test_style.astro
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,22 @@
// ^^^^^ entity.name.tag.style.html
// ^ punctuation.definition.tag.end.html

<style lang="postcss">
<!--
// ^^^^^^^^^ - source.postcss
// ^^^^ comment.block.html punctuation.definition.comment.begin.html
// <- source.postcss.embedded.html
-->
// ^^^ comment.block.html punctuation.definition.comment.end.html - source.postcss
// ^ - source.postcss - comment - meta.tag
</style>
// <- - 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

<style lang="sass">
// ^^^^^^^^^^^^^^^^^^^ meta.tag.style.begin.html
Expand Down

0 comments on commit 0ce16ee

Please sign in to comment.