Dark theme | Light theme

March 30, 2009

Add Scala syntax coloring support to JEdit

Adding syntax coloring support for Scala source files to JEdit is easy. First we must download the Scala tool support files. We can do this with the following command:

sbaz install scala-tool-support

We find sbaz in the bin directory of SCALA_HOME (the directory where we installed Scala). This will download support for a lot of editors into the SCALA_HOME/misc/scala-tool-support directory, like bluefish, emacs, vim, gedit, notepad+, textmate, textpad, ultraedit and JEdit.

To enable syntax coloring for Scala file we must copy the file SCALA_HOME/misc/scala-tool-support/jedit/mode/scala.xml to the JEDIT_HOME/modes directory. Or we can copy it to the ~/.jedit/modes directory. Next we must change the file catalog in either the JEDIT_HOME/modes or ~/.jedit/modes directory. We add the following line:

<MODE NAME="scala" FILE="scala.xml" FILE_NAME_GLOB="*.scala"/>

Now we can restart JEdit, open a Scala source file and we get syntax coloring for the right keywords.