Semantic Highlighting Package for JavaScript


#1

I love semantic highlighting and have just published what I believe to be the first semantic highlighting package available for Atom: https://atom.io/packages/language-javascript-semantic

In addition to being a useful tool for actual, productive JavaScript coding, the package also demonstrates some techniques that might serve other developers when creating similar packages for other languages:

  • Advanced use of Less to dynamically create a syntax theme that goes well with the existing one

  • A language grammar that is defined programmatically rather than through a .cson grammar file

  • Connecting an external parser (Acorn in this case)


#2

There was some discussion around this in the context of doing it for all languages here:


#3

Yes, I had seen that post. Obviously, the “tokenizing” part (which marks identifiers and puts them into color groups) has to be implemented separately for each language, ideally in the form of an actual syntax parser. The skeleton of the above mentioned package, however, can in principle be the same for all languages so there is definitely a possibility for a unified semantic highlighting system – maybe even in Atom’s default distribution.