atom/language-java

[Java] Multi-line method declaration does not get properly recognized

Opened this issue · 6 comments

From @stanleynguyen on November 14, 2018 15:4

Take note of the highlighting of public void:

Expected:
capture1

Actual:
capture

Copied from original issue: microsoft/vscode#63137

From @H-C-H on November 28, 2018 19:27

I can reproduce this error with the following code:

class C {
    public
    void foo() {}
}

screen shot 2018-11-28 at 20 26 16

void and foo are not highlighted. The TextMate scope for the declaration is

  • meta.class.body.java
  • meta.class.java
  • source.java

Everything is highlighted correctly when the access modifier public is removed. I think the bug is related to the member-variables pattern in the syntax definition (link) which is included in class-body.

The C# grammar handles this without problems:
screen shot 2018-11-28 at 20 26 06

image
image

I think this is due to limitation of the Regex engine oniguruma, which does not work across lines.

Yes, you are right. But this could be worked around by changing the code for the scope - I will have a look.

so anyone know how to fix it?

Any updates? BTW hightlighting for multi-line class declaration is also broken:

class 
Foo {
}