Programmatic Highlighting


#1

Is there a proper way to do programmatic highlighting in April 2017?

Older questions say to use language-javascript-semantic as a reference, but it’s labeled

:red_circle: This project is on hold pending resolution of atom#8669. I’m tired of chasing an undocumented private API.

I’m trying to implement a client for the Monto protocol (paper for more info here), and right now I’m using DisplayMarkers with the highlight decoration type, to get something like:

Is there a way to do proper syntax highlighting, rather than sketchy highlighting?


#2

What parts of Monto require highlighting that can’t be achieved through the standard tree of regular expressions?


#3

Monto’s a protocol which includes arbitrary software-defined (i.e. non-regex) highlighting; the languages I’m trying to highlight are developed with Silver.

Silver is used to develop extensible languages, meaning that the languages’ syntax depend on what extensions are included. Since developing extensions is done on a regular basis, and which extensions are being used may depend on the code being edited, it’s far preferable to use the compiler’s parser via the Monto protocol.

In principle, it’s possible to generate an Atom syntax file from the parser for each possible combination of extensions with the Silver core language. In practice, we have roughly a dozen extensions for C (the project is named ableC, other extensions are in our GitHub organization), and Silver itself makes heavy use of extensions internally. Our goal is for user-developed extensions to have syntax highlighting “for free,” and we already expose all necessary the highlighting information via a Monto service.

At this point, all we need to get it working with Atom is to be able to do arbitrary text highlighting.