SublimeText / CoffeeScript

Syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more.
440 stars 64 forks source link

Syntax Highlighting inside backticks #105

Closed FichteFoll closed 2 months ago

FichteFoll commented 11 years ago

You can use backticks to denote literal JavaScript blocks in CS.

What do you think about including javascript's syntax into the patterns so it highlights the code? The thing itself won't be hard, it's just a few lines more.

What I consider problematic is that some color schemes might not highlight source within source special, e.g. by changing the background color. The scheme I use (Twilight) defines something for text source but not source source.

name: "♦ Embedded Source"
scope: text source
settings:
  background: '#B0B3BA14'

Here is a preview what I made it look like:

preview

Steps:

  1. Add this to your color scheme or assure there is a source source selector:

    
         <dict>
             <key>name</key>
             <string>Embedded Source</string>
             <key>scope</key>
             <string>source source</string>
             <key>settings</key>
             <dict>
                 <key>background</key>
                 <string>#FFFFFF08</string>
             </dict>
         </dict>
  2. Change line 148-9 in CoffeeScript.tmLanguage from:

             <key>name</key>
             <string>string.quoted.script.coffee</string>

    to:

             <key>name</key>
             <string>source.js</string>
  3. Add this after line 157:

    
                 <dict>
                     <key>include</key>
                     <string>source.js</string>
                 </dict>
gerardo commented 10 years ago

+1 to this change. React projects use JSX, which is sort of markup inside the coffeescript source. Right now it looks like this:

image

It would be great to have syntax highlighting inside the backticks.

pdufour commented 10 years ago

+1, working with React as well.

damassi commented 10 years ago

+1 Too! I've actually switched to the method described here: http://neugierig.org/software/blog/2014/02/react-jsx-coffeescript.html

in order to work around the syntax highlighting limitations which were driving me crazy.

ghost commented 7 years ago

screen shot 2017-09-27 at 4 44 18 pm This issue still hasn't been fixed. I'm using the Flatland theme on Sublime Text 3 with Monokai as my color scheme