sublime-better-coffeescript icon indicating copy to clipboard operation
sublime-better-coffeescript copied to clipboard

Syntax Highlighting inside backticks

Open FichteFoll opened this issue 10 years ago • 4 comments

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>
    

FichteFoll avatar Sep 20 '13 02:09 FichteFoll

+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.

gerardo avatar Jan 08 '14 03:01 gerardo

+1, working with React as well.

pdufour avatar Mar 16 '14 08:03 pdufour

+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.

damassi avatar May 05 '14 21:05 damassi

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

ghost avatar Sep 27 '17 11:09 ghost