Sublime Forum

Scala syntax highlighting problem

#1

Check out the syntax highlighting on the following valid scala code in sublime version 2.0.1 Build 2217:

object HelloWorld { class Complex(_re:Double, _im:Double) { def re = _re def im = _im override def toString() = "" + re + (if (im<0) "" else "+") + im + "j" } def main(args: Array[String]) { println(new Complex(1.5, 2.3)) } }

This is what I see:

0 Likes

#2

In your Scala.tmLanguage file change the following line to what you see:
[pre=#2D2D2D] 619 </?([a-zA-Z][a-zA-Z0-9]*)[/pre]

0 Likes

#3

Awesome. that fixed it.

0 Likes

#4

Hi.

I seem to be having the same problem in Sublime Text 3 (build 3059 installed with the Ubuntu .deb package).

I can’t locate the Scala.tmLanguage file. All I can find is some file that seems to be compiled at $HOME/.config/sublime-text-3/Cache/Scala/Scala.tmLanguage.cache

The only other thing I find is the global /opt/sublime_text/Packages/Scala.sublime-package file that seems to be a binary file as well.

How can I fix the Scala syntax highlighting file for Sublime Text 3?

0 Likes

#5

Nevermind. I figured it out.

For future reference the syntax file is in /opt/sublime_text/Packages/Scala.sublime-package which is a zip file.

So you need to copy that file and unzip it, change the Scala.tmLanguage file as per the instructions above and then rezip the whole thing and replace /opt/sublime_text/Packages/Scala.sublime-package with that zip file instead.

It’s a bit surprising that this hasn’t been fixed in the official version. I’ll send in a feature request and point this out.

UPDATE: feedback sent (sublimetext.userecho.com/topic/4 … -included/)

0 Likes