diff --git a/JavaScript/Comments.tmPreferences b/JavaScript/Comments.tmPreferences index 939619f676..71a87cf1dc 100644 --- a/JavaScript/Comments.tmPreferences +++ b/JavaScript/Comments.tmPreferences @@ -2,7 +2,7 @@ scope - source.js, source.jsx, source.ts, source.tsx + source.js, source.jsx, source.ts, source.tsx, meta.jsx meta.tag.name, meta.jsx meta.tag.attributes settings shellVariables diff --git a/JavaScript/JSX Comments.tmPreferences b/JavaScript/JSX Comments.tmPreferences index e62e1b10a4..f1239d3772 100644 --- a/JavaScript/JSX Comments.tmPreferences +++ b/JavaScript/JSX Comments.tmPreferences @@ -5,7 +5,7 @@ name JSX Comments scope - source.jsx meta.jsx - source.jsx.embedded.jsx, source.tsx meta.jsx - source.tsx.embedded.jsx + meta.jsx settings shellVariables diff --git a/JavaScript/JSX.sublime-syntax b/JavaScript/JSX.sublime-syntax index f9c694b24b..235f7cff52 100644 --- a/JavaScript/JSX.sublime-syntax +++ b/JavaScript/JSX.sublime-syntax @@ -18,9 +18,34 @@ contexts: - include: jsx-tag jsx-interpolation: + - match: (?={/\*) + branch_point: jsx-interpolation-comment + branch: + - jsx-interpolation-comment + - jsx-interpolation-plain + - match: (?={) + push: jsx-interpolation-plain + + jsx-interpolation-comment: + - match: '({)(/\*)' + captures: + 1: punctuation.definition.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.definition.interpolation.end.js + pop: true + - match: (?=\*/) + fail: jsx-interpolation-comment + + jsx-interpolation-plain: - match: '{' scope: punctuation.definition.interpolation.begin.js - push: + set: - - meta_scope: meta.interpolation.js - meta_content_scope: source.js.embedded.jsx - match: '}' @@ -62,7 +87,7 @@ contexts: - jsx-tag-name jsx-tag-attributes: - - meta_scope: meta.tag.js + - meta_scope: meta.tag.attributes.js - match: '>' scope: punctuation.definition.tag.end.js diff --git a/JavaScript/tests/syntax_test_jsx.jsx b/JavaScript/tests/syntax_test_jsx.jsx index 55a83c9287..c5a4e366d3 100644 --- a/JavaScript/tests/syntax_test_jsx.jsx +++ b/JavaScript/tests/syntax_test_jsx.jsx @@ -71,7 +71,7 @@ ; ;