Skip to content

Commit

Permalink
Syntax highlight backtick quoted strings with JSX
Browse files Browse the repository at this point in the history
Resolves #105
  • Loading branch information
deathaxe committed Aug 26, 2024
1 parent 21c8ca4 commit fd7f94c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
15 changes: 6 additions & 9 deletions CoffeeScript.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,12 @@ contexts:

backtick-quoted-strings:
- match: \`
scope: punctuation.definition.string.begin.coffee
push: backtick-quoted-string-body

backtick-quoted-string-body:
- meta_scope: meta.string.coffee string.quoted.script.coffee
- match: \`
scope: punctuation.definition.string.end.coffee
pop: true
- include: string-escapes
scope: meta.string.coffee string.quoted.script.coffee punctuation.definition.string.begin.coffee
embed: scope:source.jsx
embed_scope: meta.string.coffee meta.embedded.coffee source.jsx.embedded.coffee
escape: \`
escape_captures:
0: meta.string.coffee string.quoted.script.coffee punctuation.definition.string.end.coffee

double-quoted-strings:
- match: \"
Expand Down
17 changes: 17 additions & 0 deletions tests/syntax_test_scope.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,23 @@ class App.Router extends Snakeskin.Router
# ^^^ meta.string.heredoc.coffee string.quoted.single.coffee punctuation.definition.string.end.coffee
# ^ - meta.string - string

`
# ^ meta.string.coffee string.quoted.script.coffee punctuation.definition.string.begin.coffee
# ^ meta.string.coffee meta.embedded.coffee source.jsx.embedded.coffee - string
var i = 0;
# ^^^^^^^^^^^ meta.string.coffee meta.embedded.coffee source.jsx.embedded.coffee
# ^^^ keyword.declaration
return (<h1>Hello {World}</h1>)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.coffee meta.embedded.coffee source.jsx.embedded.coffee
# ^^^^^^^^^^^^^^^^^^^^^^ meta.group.js meta.jsx.js
# ^^^^ meta.tag
# ^^^^^ meta.tag
`
# <- meta.string.coffee meta.embedded.coffee source.jsx.embedded.coffee - string
#^ meta.string.coffee meta.embedded.coffee source.jsx.embedded.coffee - string
# ^ meta.string.coffee string.quoted.script.coffee punctuation.definition.string.end.coffee
# ^ - meta.string - string

///
# <- - meta.string
#^ - meta.string
Expand Down

0 comments on commit fd7f94c

Please sign in to comment.