jskinner / DefaultPackages

Old bug tracker for Sublime Text's "Default Packages", e.g. bad syntax highlighting
http://web.archive.org/web/20150524043750/https://www.sublimetext.com/forum/viewtopic.php?f=2&t=12095
26 stars 2 forks source link

JavaScript: syntax highlighting breaking after escaped string #181

Closed FlamingTempura closed 8 years ago

FlamingTempura commented 8 years ago

If a string contains an escaped single quote followed by a colon, the remainder of the file is incorrectly highlighted. For example:

var a = '\'.'; // this works
var b = '\':'; // this doesn't work
console.log('blah blah', a); // highlighting broken
var c = function () {};
var d = {
    a: 1,
    b: 2 // highlighting back to normal
};
var e = function () {};
return a;

appears in Sublime Text 3 as: image

It appears to got back to normal following an object declaration.

Build 3103, Ubuntu 14.04

MattDMo commented 8 years ago

There has been a great deal of work on the JavaScript syntax since the release of 3103. To test the current version, copy the contents of the current JavaScript.sublime-syntax to a new view in Sublime, then save the file as Packages/JavaScript/JavaScript.sublime-syntax where Packages is ~/.config/sublime-text-3/Packages on Linux. You'll have to create the JavaScript folder manually. Depending on your system's setup, you may not be able to directly access the .config folder through Sublime's Save dialog. As a workaround, just create a symlink:

ln -s ~/.config ~/config

and save in ~/config/sublime-text-3/Packages/JavaScript.

Once done, the highlighting should correct itself automagically. If not, close and reopen the view. It should now look like this (using my Neon Color Scheme):

Neon

or with the default Monokai color scheme:

Monokai
FlamingTempura commented 8 years ago

That fixed it, thanks!