atom / language-java

Java package for Atom
Other
62 stars 59 forks source link

Minus operator confused with variable after new constructor #192

Closed felixhao28 closed 5 years ago

felixhao28 commented 5 years ago

Current behavior

image

Expected:

image

Code:

class A {
    void f() {
        int a = new Date().getTime() - start.getTime();
    }
}

Fix:

Change this line from

'end': '(?=;|\\)|,|:|}|\\+)'

to

'end': '(?=;|\\)|,|:|}|\\+|\\-)'
                           ^^^
felixhao28 commented 5 years ago

Equal sign is also impacted for the same reason:

class A {
    void f() {
        new Integer(65535).floatValue() == 65535.0f
    }
}

The full expansion of this regex might be '(?=;|\\)|,|:|}|\\-|\\+|\\*|\\/|%|!|&|\\||=)';

sadikovi commented 5 years ago

I will check, thanks.