(Language Package for Sublime Text 2/3)
The default JavaScript language in Sublime Text is... well... not very good.
Here are some ways in which it lacks:
- dollar signs (
$
) are not treated as word-characters. This means that in patterns like$true
, thetrue
part is treated as a constant, instead of part of the identifier - unicode identifiers are not supported
- it detects obsolete reserved words, and doesn't detect current reserved words
- its DOM library is out-dated
- it doesn't detect features of ECMAScript 5
- in patterns like
myObject.true
, it thinks thattrue
is a constant, as oppossed to an identifier - no JavaDoc support
- regular expression literals aren't detected in some valid contexts
- no distunguishing between decimal points and property accessors (
.
) - many other imperfections
So I decided to build a completely new JavaScript language definition, from the ground up.
Here are some of the improvements:
- all valid JavaScript identifiers are detected, with full Unicode support (and the dollar sign is treated as a word-character)
- updated DOM library; obsolete items removed, added support for Canvas, SVG functions, and more
- Includes all features of ECMAScript 5, and some of ES6 (will make an ES6 version when the spec if finalized)
- added JavaDoc support
- Decimal points and property accesors (
.
) are always distunguished properly - Many, many, many more
In short, it's as perfect as a JavaScript language definition can get for Sublime Text.
If you use JavaScript Ultimate with any of your existing themes, it will work just fine, and you can you enjoy a perfect JavaScript language definition.
But, if you use any of the themes that come with this bundle, you can get two additional benefits while writing JavaScript:
- Regular Expression comprehension
- Distinguishing between normal operators and bitwise operators
Currently, the package comes with two flavors of highlighting - JavaScript
, and JavaScript (DOM)
.
You can use JavaScript
when writing Node.js or other JavaScript applications. It includes only native JavaScript - it doesn't highlight things that are in the DOM.
The JavaScript (DOM)
language is available for when you're writing front-end scripts.
You can switch between these whenever you want.
I plan on creating a Node.js flavor too, at some point.
JavaScript Ultimate is for Sublime Text 2 and 3, but should also work in Textmate.
JavaScript Ultimate will work perfectly fine with the Nodejs package, Node Completions package, and any other code completions package you can find.
If you'd like to use the jQuery package, you can do that too! Thanks to Zander Martineau for making the jQuery package properly detect and work with JavaScript Ultimate!
WARNING SublimeLinter:
If you are using SublimeLinter to lint your js files, installing Javascript Ultimate will make SublimeLinter silently fail. You need to add the following line to your user settings to make it work again. In Preferences > Package Settings > SublimeLinter > Settings - User
"syntax_map: {
"javascript (dom)": "javascript"
}
WARNING Better Javascript:
If you have Better JavaScript installed, you need to first remove it before installing JavaScript Ultimate. JavaScript Ultimate is considered a complete upgrade from Better JavaScript
, so you won't need it anymore.
- Monokai JU (just like defualt Monokai, but with regexp comprehension and bitwise operator detection)
- Twilight JU
- Solarized JU (light)
- Solarized JU (dark)
- Indiana Jones (best with gray_antialias in user settings)
- Wes Anderson (best with subpixel_antialias in user settings)
- Tron (best with gray_antialias in user settings)
You can install this package, and any other package mentioned here, using Package Control.
When JavaScript Ultimate is installed, the default JavaScript package should automatically me disabled.
Before uninstalling JavaScript Ultimate, be sure close all open JavaScript/JSON
files. Then, look into your User Settings, and remove "JavaScript" from the "ignored_packages" list.
You can then safely uninstall JavaScript Ultimate.
It's normal to see a few errors from Sublime about not being able to find syntax files. Just exit Sublime and re-open it, and everything should be fixed.
- Joshua Wise - @JoshuaWise
This bundle is licensed under the MIT license. Use it, change it, fork it, sell it. Do what you will, but please leave the author attribution.