RFH: Updating highlighters for 0.6 syntax

Hi there! As you may know, Julia 0.6 is now the stable release of Julia. This version has brought some significant changes to syntax, including to type definitions, free typevars, and infix isa. While many editor plugins and highlighters have been updated appropriately, a lot of highlighters in the wild don’t yet recognize these things. Some examples include:

  • Pygments, which highlights Jupyter notebooks

  • CodeMirror, which highlights Jupyter notebooks

  • Google Prettify, which highlights Stack Overflow

    • This actually has no Julia definition at all, the default highlighter just happens to work surprisingly well on Julia

    • See here for an existing request for Julia support

  • Discourse :scream:

    • If it uses highlight.js, it might just require updating the version used by Discourse, since that has already been updated for 0.6

(Please let me know if you come across others, and I can update this list accordingly.) Though it has been updated for 0.6, the definition for TextMate could still be vastly improved, and that’s actually what powers GitHub’s highlighting of Julia.

Thus I would like to request help from the community in getting everything updated. Having things nicely highlighted on 0.6 and higher will make us look that much fancier and more impressive. :sunglasses:

If you need guidance in terms of what definitions can look like, try checking out the Julia definitions for things like highlight.js, or let me know if you have any questions. Thanks in advance to anyone willing to help out!

2 Likes

Code Mirror (which does) jupyter hasn’t been updated since Feb.
https://github.com/codemirror/CodeMirror/blob/3d89b71b955b72e61430f7f38e2350489cad9e15/mode/julia/julia.js

As well as JuPyTer it is used by a number of other online text editors.
(I think just about everything that requires live highlighting in a text box uses code mirror, but there might be other compeditors)

For the IJulia case
It is actually really annoying, because to get new syntax highlights (and with it also some of the autoindentation),
it can’t just have a new release of IJulia,
it requires a new release of CodeMirror, followed by a New release of JuPyTer.
and I’m not sure that a release of IJulia is required at all.

More generally I wish there was a way we could move all those highlighers into to JuliaEditorSupport org.
But they are individual files in other repos, so it is basically a pain – submodule hell.
It might be a good idea to create a Repo that tracks all of them with just a markdown file with links (something like your openning post),
and then issues can be raised for problems.
What do you think @ararslan ?

1 Like

Discourse master just updated to the newest version of highlight.js and that change should drop soon™ on this instance.

1 Like

I just updated the grammar file for the VS Code julia extension. I’m currently just taking the atom-language-julia grammar periodically and then convert it from cson to json and that is it…

I’ve been “maintaining” the Codemirror highlighter, but haven’t really made some time for updating it to work on 0.6. I’ll look into it.

2 Likes

I know it’s subideal, but as soon as the codemirror syntax file is updated, hardcore Jupyter users could manually download it to the right local location to get the benefits immediately.

That seems like a good idea indeed. I’m not an EditorSupport member so I can’t make said repo but if you’d be willing to do that then I think that’d certainly be helpful to track things going forward.

Maybe we can even make IJulia look for the latest version of the Codemirror highlighter and install it when building IJulia.

3 Likes

Go forth and raise issues:
https://github.com/JuliaEditorSupport/3rd-Party-Highlighters

I just pushed a PR to update the syntax over CodeMirror, and another one over IJulia.jl to download the latest syntax highlighter version when building IJulia

https://github.com/codemirror/CodeMirror/pull/4842
https://github.com/JuliaLang/IJulia.jl/pull/569

4 Likes