Skip to content

Commit

Permalink
[JavaScript] Use named contexts for JSX interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Dec 18, 2024
1 parent 99bcd70 commit 705413f
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions JavaScript/JSX.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,35 @@ contexts:
push: jsx-interpolation-plain

jsx-interpolation-comment:
- match: '({)(/\*)'
- match: ({)(/\*)
captures:
1: punctuation.section.interpolation.begin.js
2: punctuation.definition.comment.begin.js
set:
- meta_include_prototype: false
- meta_scope: meta.interpolation.js comment.block.js
- match: '(\*/)(})'
captures:
1: punctuation.definition.comment.end.js
2: punctuation.section.interpolation.end.js
pop: 1
- match: (?=\*/)
fail: jsx-interpolation-comment
set: jsx-interpolation-comment-body

jsx-interpolation-comment-body:
- meta_include_prototype: false
- meta_scope: meta.interpolation.js comment.block.js
- match: (\*/)(})
captures:
1: punctuation.definition.comment.end.js
2: punctuation.section.interpolation.end.js
pop: 1
- match: (?=\*/)
fail: jsx-interpolation-comment

jsx-interpolation-plain:
- match: '{'
- match: \{
scope: punctuation.section.interpolation.begin.js
set:
- - meta_scope: meta.interpolation.js
- meta_content_scope: source.js.embedded.jsx
- match: '}'
scope: punctuation.section.interpolation.end.js
pop: 1
- expression
set: jsx-interpolation-plain-body

jsx-interpolation-plain-body:
- meta_scope: meta.interpolation.js
- meta_content_scope: source.js.embedded.jsx
- match: \}
scope: punctuation.section.interpolation.end.js
pop: 1
- include: expressions

jsx-expect-tag-end:
- meta_content_scope: meta.tag.js
Expand Down

0 comments on commit 705413f

Please sign in to comment.