atom/language-java

Minus operator confused with variable after new constructor

Closed this issue · 2 comments

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': '(?=;|\\)|,|:|}|\\+|\\-)'
                           ^^^

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 '(?=;|\\)|,|:|}|\\-|\\+|\\*|\\/|%|!|&|\\||=)';

I will check, thanks.