atom / language-java

Java package for Atom
Other
62 stars 59 forks source link

Enum not correctly hightlighted when mixed with constructor and code overrides #211

Closed Vigilans closed 5 years ago

Vigilans commented 5 years ago

Description

Originally created in https://github.com/redhat-developer/vscode-java/issues/974 by @orblazer :

Hello, The color of first item when the enum overwrite is wrong

Environment
  • Operating System: Windows 10
  • JDK version: jdk1.8.0_212
  • Visual Studio Code version: 1.35.1
  • Java extension version: 0.46.0
Steps To Reproduce
  1. Create an enum with function
  2. Override that function in enum items

[attach a sample project reproducing the error] attach logs

Current Result

wrong

Expected Result

right

Additional Informations

The path for color is different :

Path of current result : wrong-dt

Path of expected result : right-dt

I think the path for the current result is right bug its just parsing is broken.

Vigilans commented 5 years ago

The problem is infact caused by the overly restricted rules specified in syntax file

Currently, the enum syntax will try to match three patterns:

But when constructor and code overrides are applied on a field at the same time, the pattern matching fails, just as follows:

image

Worth noting that a new line also breaks current syntax: image