Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

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

Open
alexr00 opened this issue Jan 8, 2019 · 6 comments
Open

Comments

@alexr00
Copy link

alexr00 commented Jan 8, 2019

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

@alexr00
Copy link
Author

alexr00 commented Jan 8, 2019

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

@alexr00 alexr00 changed the title [Java] Syntax highlighting not working on multi-line method declaration [Java] Multi-line method declaration does not get properly recognized Jan 8, 2019
@alexr00
Copy link
Author

alexr00 commented Jan 8, 2019

image
image

@felixhao28
Copy link

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

@sadikovi
Copy link
Contributor

sadikovi commented Jan 8, 2019

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

@JoeyRxy
Copy link

JoeyRxy commented Aug 31, 2019

so anyone know how to fix it?

@Eskibear
Copy link
Contributor

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

class 
Foo {
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants