Skip to content

Commit

Permalink
Restrict snippets
Browse files Browse the repository at this point in the history
This commit disables snippet in ...

- comments
- literal or interpolated strings
- embedded or interpolated code blocks (from template languages)
- HTML tags
- Markdown files (but not in fenced code blocks)

Using `- source.astro <scope>` in order to only exclude scopes belonging to
possibly embedded Astro code block in question.
  • Loading branch information
deathaxe committed Nov 2, 2024
1 parent 208eaff commit 097a5a7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
12 changes: 11 additions & 1 deletion Snippets/component.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ $1
$0
]]></content>
<tabTrigger>component</tabTrigger>
<scope>source.astro</scope>
<scope>
source.astro
- source.astro meta.tag
- source.astro meta.embedded
- source.astro meta.interpolation
- source.astro meta.string
- source.astro comment
- source.astro source
- source.astro string
- (text.html.markdown - markup.raw.code-fence source.astro)
</scope>
<description>Component</description>
</snippet>
12 changes: 11 additions & 1 deletion Snippets/page_html.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ $1
</html>
]]></content>
<tabTrigger>page_html</tabTrigger>
<scope>source.astro</scope>
<scope>
source.astro
- source.astro meta.tag
- source.astro meta.embedded
- source.astro meta.interpolation
- source.astro meta.string
- source.astro comment
- source.astro source
- source.astro string
- (text.html.markdown - markup.raw.code-fence source.astro)
</scope>
<description>Page with full HTML</description>
</snippet>
12 changes: 11 additions & 1 deletion Snippets/page_layout.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ import ${1:Layout} from "../layouts/$1.astro"
</$1>
]]></content>
<tabTrigger>page_layout</tabTrigger>
<scope>source.astro</scope>
<scope>
source.astro
- source.astro meta.tag
- source.astro meta.embedded
- source.astro meta.interpolation
- source.astro meta.string
- source.astro comment
- source.astro source
- source.astro string
- (text.html.markdown - markup.raw.code-fence source.astro)
</scope>
<description>Page from Layout</description>
</snippet>

0 comments on commit 097a5a7

Please sign in to comment.