JavaScriptNext.tmLanguage
JavaScript language definition for TextMate and SublimeText2
A Sublime Text syntax package that correctly highlights modern ES6+ JavaScript features like classes, arrow functions, and destructuring.
JavaScript.tmLanguage Explanation
This repository provides an improved way for text editors like Sublime Text to recognize and colorize JavaScript code. When you write JavaScript, the editor needs to understand the syntax so it can highlight different parts in different colors—keywords in one shade, strings in another, comments in a third. This project replaces the default JavaScript highlighter with a smarter version that handles modern JavaScript features more accurately and consistently.
The core problem it solves is that JavaScript evolves faster than built-in syntax highlighters usually do. By the time a new feature ships in JavaScript (like arrow functions or classes), many editors' default definitions haven't caught up yet, so the code looks wrong. This project was built to add support for ES6 (now called ES2015)—a major JavaScript update that introduced classes, arrow functions, destructuring, modules, and generators. With this installed, those modern features highlight correctly instead of showing up as errors or generic code.
To use it, you install it as a package in Sublime Text through a tool called Package Control, then switch JavaScript files to use this syntax definition instead of the default one. You can also pick a matching color scheme that pairs well with this highlighter. After that, whenever you open a JavaScript file, it uses these improved rules to color your code.
The project is built as a set of YAML files that define the language rules—what counts as a keyword, what's a string, how to spot a function definition, and so on. These YAML files are then converted into the XML format that Sublime Text actually needs. The choice to use YAML is deliberate: it's much less verbose and tedious to edit than raw XML, making it easier for contributors to improve the syntax definitions over time.
Where it fits
- Install this package in Sublime Text so modern JavaScript syntax like arrow functions and classes highlights correctly.
- Pair the syntax highlighter with a matching color scheme for a more readable editing experience.
- Contribute new syntax rules by editing the simpler YAML files instead of raw XML.
- Fix a Sublime Text setup where new ES6 features show up as errors or unstyled generic code.