Home Download Buy Blog Forum Support

tmLanguage - Variable in a string

tmLanguage - Variable in a string

Postby highend on Tue Jan 29, 2013 6:40 am

Hi,

is it possible to display variables inside a string with a different color?

Code: Select all
      <dict>
         <key>name</key>
         <string>string</string>
         <key>match</key>
         <string>["'].*?["']</string>
      </dict>

      <dict>
         <key>name</key>
         <string>variable.parameter</string>
         <key>match</key>
         <string>\$[A-Za-z_][A-Za-z0-9_]*</string>
      </dict>


Atm it looks like:
$test = "$drive:\$folder";

And I'd want it to look like:
$test = "$drive:\$folder";

=> Variables in strings should have a precedence over the string color itself.

Is that possible?
highend
 
Posts: 93
Joined: Fri Jan 20, 2012 2:47 pm

Re: tmLanguage - Variable in a string

Postby Binocular222 on Tue Jun 04, 2013 4:06 am

Yes, Add this:
Code: Select all
        <dict>
            <key>captures</key>
            <dict>
                <key>2</key>
                <dict>
                    <key>name</key>
                    <string>string.quoted.xys</string>
                </dict>
                <key>1</key>
                <dict>
                    <key>name</key>
                    <string>punctuation.quote.double</string>
                </dict>
                <key>4</key>
                <dict>
                    <key>name</key>
                    <string>punctuation.quote.double</string>
                </dict>
            </dict>
            <key>name</key>
            <string>quoted.string.line.xys</string>
            <key>match</key>
            <string>(")(([^"]|"")*)(")</string>
        </dict>

        <dict>
            <key>captures</key>
            <dict>
                <key>1</key>
                <dict>
                    <key>name</key>
                    <string>label.xys</string>
                </dict>
                <key>2</key>
                <dict>
                    <key>name</key>
                    <string>punctuation.definition.label.xys</string>
                </dict>
            </dict>
            <key>name</key>
            <string>label.line.xys</string>
            <key>match</key>
            <string>^([^: ]+)(:)\s</string>
        </dict>

But personally, this make .xys files too much colorful → distractive. I'd rather stay with your atm
Binocular222
 
Posts: 55
Joined: Sat May 18, 2013 4:10 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 37 guests