atom / language-java

Java package for Atom
Other
62 stars 59 forks source link

Field values are incorrectly highlighted #158

Closed aeschli closed 6 years ago

aeschli commented 6 years ago

From @rickyah on September 3, 2018 8:55

Issue Type: Bug

Using this snippet makes any text written after the BUG_SAMPLE variable to render as a string:

final class Example
{
    private static final String MODULE = "test"

    private static final String BUG_EXAMPLE = "window." + TEST + "aFunction();";

    Example(PopupWebView popupWebView)
    {
        this.popupWebView = popupWebView;
    }
}

Atom (language-java 0.30.0) highlights this correctly, but VSCode (on master) ends the variable declaration with the =.

screenshot from 2018-09-12 15-56-25 screenshot from 2018-09-12 15-56-50

aeschli commented 6 years ago

I think the problem is with change https://github.com/atom/language-java/commit/2f20bc5a5b07686ec0139e2969431210d81b6991#diff-854de79c7abc9c505592fcddfc4654f9

= got added to the end pattern, which has a higher priority that the embedded patterns.

sadikovi commented 6 years ago

This is not a bug, we explicitly changed variable declaration to end with = in case of int a = 123; and with ; in case of int a;. See https://github.com/atom/language-java/pull/146.

sadikovi commented 6 years ago

Sorry, you are right. It is a bug now in master, which I introduced. I will have a look and try coming up with a fix ASAP.