Skip to content

Commit

Permalink
Forward compatibility with up-coming ST releases
Browse files Browse the repository at this point in the history
This commit is to ensure not to break syntax highlighting by ST releases
with refactored JSX syntax (see: sublimehq/Packages/pulls/4114).
  • Loading branch information
deathaxe committed Jan 4, 2025
1 parent 0ffd95f commit 969dd86
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions Syntaxes/Embeddings/TSX (for Astro).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,36 @@ contexts:
# https://docs.astro.build/en/basics/astro-syntax/#multiple-elements
- meta_include_prototype: false
- meta_scope: meta.jsx.js
- match: '<(?=\s*[/>{{identifier_start}}])'
- match: <
scope: punctuation.definition.tag.begin.js
push: jsx-tag-attributes-top
push: jsx-tag-begin
- include: else-pop

jsx-tag-begin:
# required until sublimehq/Packages/PR#4114
- meta_include_prototype: false
- meta_scope: meta.tag.js
# note: type parameter modifiers indicate generic lambda
- match: (?=(?:in|out|const){{identifier_break}})
fail: arrow-function
- match: /
scope: punctuation.definition.tag.begin.js
set:
- jsx-expect-unmatched-tag-end
- jsx-tag-name
- match: (?=\S)
set:
- jsx-tag-attributes
- tsx-tag-check
- jsx-tag-name

jsx-expect-unmatched-tag-end:
# required until sublimehq/Packages/PR#4114
- meta_include_prototype: false
- meta_scope: invalid.illegal.unmatched-tag.js
- meta_content_scope: meta.tag.js
- include: jsx-expect-tag-end

jsx-tag-attributes:
- meta_prepend: true
- include: HTML (Astro).sublime-syntax#astro-directives

0 comments on commit 969dd86

Please sign in to comment.