atom / language-java

Java package for Atom
Other
62 stars 58 forks source link

Catch parameter not correctly highlighted when declared in new line or with a comment in between #219

Closed Vigilans closed 4 years ago

Vigilans commented 4 years ago

Description

Catch parameter name is highlighted as type when declared in new line or with a comment in between.

Steps to Reproduce

Paste the following code to editor:

public static void main(String[] args) {
    try {
        // something
    } catch // this is a comment
    (NoSuchMethodException |
        SecurityException
      | InstantiationException | llegalAccessException |
      IllegalArgumentException | invocationTargetException 
      e
    ) {
        e.printStackTrace();
    }
}

public static void main(String[] args) {
    try {
        // something
    } catch // this is a comment
    (NoSuchMethodException |
        SecurityException
      | InstantiationException | llegalAccessException |
      IllegalArgumentException | invocationTargetException /* comment */ e
    ) {
        e.printStackTrace();
    }
}

Expected behavior: e is highlighted as variable.parameter.java

Actual behavior:

e is highlighted as storage.type.java: image

Reproduces how often: Always

lkashef commented 4 years ago

Hello @Vigilans, thanks for the report, I have simplified the examples, let me know if you have any comments.

Closing bracket in on a new line.

try {} catch (ex e
){}

Comment between the type and variable name.

try {} catch (ex /**/ e){}
sadikovi commented 4 years ago

It is basically two scenarios:

Vigilans commented 4 years ago

@lkashef

try {} catch (ex e
){}

should be

try {} catch (ex
e){}
lee-dohm commented 4 years ago

Thanks @sadikovi! 🙇