ReasonML Syntax Highlighting

Hey everyone! First of all, thanks for making Glitch! It’s a great platform with a super low bar to entry :smile:

I was wondering if you could add syntax highlighting support for ReasonML. I recently made a project with it on here and it would be better to work on with syntax highlighting support.

It looks like you use CodeMirror for the editor, just the the try page for Reason. It seems that the Try page uses the Rust language mode (https://github.com/reasonml/reasonml.github.io/blob/c35e4e1898f8ca9be6b69aefaf33cf4b59c321e7/src/pages/try.js#L613-L621), so maybe that would work?

1 Like

Hi @rrdelaney :slight_smile:

what’s the file extension for ReasonML source files? Can you try in your browser if these two lines of code make the file highlight work correctly?

Open the webconsole while on a ReasonML source file and:

application.editor().setOption("mode", "text/x-rustsrc");
CodeMirror.autoLoadMode(application.editor(), "rust");

thanks!

The extension for Reason files is .re. Looks like Rust mode worked really well for Reason :smiley:

Here’s the project link btw: https://glitch.com/edit/#!/reason-on

Hi Ryan,

we just added Rust mode to .re files :slight_smile: