1

I just upgraded to Sublime Text 3.

I'm using my existing Color scheme from Sublime Text 2. But now multi language code highlighting no longer works.

Sublime Text 3 Sublime Text 3

Sublime Text 2 Sublime Text 2

Can someone help me comeup with the custom scope for my tmTheme.

1 Answer 1

1

Congratulations on upgrading, it was a good choice. I'm using ST3 Build 3120, the latest development build, so the language definitions may have changed somewhat, but not significantly, if you're using the public beta Build 3114. I also use the Neon Color Scheme (full disclosure: I'm the developer), which has a very large number of specific scopes compared to some other color schemes like Monokai or Solarized which reuse the same colors for a variety of different language features. Finally, since I'm a color scheme designer, I use tools like ScopeHunter and ScopeAlways to determine which scopes and theming elements are active at any point in the text.

So, here's a screencap of your code plus a couple of other test lines using Sublime's HTML syntax:

HTML

and here is the same code, moments later, captured using the PHP syntax:

PHP

What we can see is that, in the lower left corner, ScopeAlways is indicating that, at the position of the cursor, the base scope of the HTML file is text.html.basic, while the PHP one is embedding.php text.html.basic. So far, so good - this is normal. More importantly, however, we can see the obvious difference in highlighting between HTML and PHP, including the contents of the id attribute as compared to the other attributes, and the coloring (or lack thereof) of the embedded PHP code (yes, I know I'm missing a ; at the end of the isolated PHP code at the bottom - adding one in doesn't change anything).

So, my first suggestion would be, if you're not already using it, is to set the syntax of the file to PHP. You can either select from the menu on the far right side of the bottom bar, or by selecting View → Syntax → and choosing from the options available.

If you're already using the PHP syntax, you should know that since the beginning of this year (more or less), many of Sublime's language description syntax files have been significantly or completely rewritten, PHP and HTML among them. They were in sore need of modernization and speed-up in some cases, and with the advent of the sublime-syntax format (much more powerful than the old, but still supported, tmLanguage format), a better regex engine for .sublime-syntax files, and the hiring by Sublime HQ of Will Bond (of Package Control fame) to do a lot of things that Jon Skinner (Sublime's author) didn't have time or interest in doing, the development process of both Sublime itself as well as the syntax definitions (which were open-sourced at the same time) has increased substantially. That is a really long-winded way of saying that a lot of stuff has changed in a relatively short amount of time, and color schemes that were written with the old versions of the HTML and PHP syntaxes in mind may not be perfect for the new versions. So, you may want to either go through the new syntaxes and update your color scheme, if you're that kind of person, or you can try some other schemes like Neon, which have already been through that process.

Getting back to that weird id highlighting - I'm going to release a new version of Neon fairly soon that fixes that issue, and colors the contents of the id attribute just like class or any other attribute. I'll also try and find out why they did that.

I hope this helps. Good luck!

2
  • It seems that the current stable version ST3 Build 31114 is buggy. I tried the beta build you specified and it works like a charm. Thanks for pointing that out.
    – 3s2ng
    Commented Aug 23, 2016 at 7:13
  • @3s2ng that's interesting, what problems did you have with 3114? The bug tracker for packages is on Github at the site I linked, for all other issues you can check out the issue tracker here. Personally, I prefer the dev builds because they get the latest goodies, and they tend to be a little bit more stable, as deal-killing bugs are fixed quickly. Public builds shouldn't have any of those bugs, though.
    – MattDMo
    Commented Aug 23, 2016 at 12:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.