Sublime Forum

[ST3?] Another Java syntax highlighting bug

#1

Try this with the default ST3 Java syntax

class Whatever {
  private static List<Stuff> stuffList = SomeClass.staticMethod(
    new Something(374284340, -1220723816, "some string with Bad Syntax"),
    new SomethingElse("more bad syntax"));
}
0 Likes

#2

I can’t guarantee this will fix it (or rather won’t cause other issues), but try searching for the “entity.name.function.java” in the Java.tmLanguage file. If you look a little farther down, you can see the patterns being used for this scope. Right now (well I’m looking in ST2 right now), the only pattern listed is

<array> <dict> <key>include</key> <string>#parameters</string> </dict> </array>

Try replacing it with the following.

<array> <dict> <key>include</key> <string>#anonymous-classes-and-new</string> </dict> <dict> <key>include</key> <string>#parameters</string> </dict> </array>

There may be a better repository to include, but that’s the one I thought might fit.

This is what it looked like for me after making that change.
[pre=#272822]class Whatever {
private static* List<Stuff>* stuffList = SomeClass.staticMethod(
new* Something*(374284340, -1220723816, “some string with Bad Syntax”),
new* SomethingElse*(“more bad syntax”));
}[/pre]

0 Likes