Lack of highlighting for class `fields`, `ENUMs`, and `annotations` in Java code
Opened this issue · 6 comments
In recent times, the components listed in the title are being displayed incorrectly in Java code. Below is an example of how the same code currently looks compared to the original theme in IntelliJ IDEA
:
Dark Plus Darcula (IntelliJ imitation)
Darcula IntelliJ IDEA
Unfortunately, it's obvious to the naked eye how much the code readability has decreased :(
Hi Herman, thanks for the issue. Can replicate this problem and will look into this soon.
@Herman0802 This actually a combination of two problems:
1. This theme lacks support for certain Textmate scopes
I've published v1.2.0 to fix it. Just update the extension in VS Code.
2. Your local VS Code environment provides no semantic highlighting for Java
The default pattern-based highlighting (Textmate) that comes with the editor does not suffice. So the theme won't know that a particular "symbol" stands for a field in a Java class. That's why the color falls back to no-coloring.
To address this, nothing can be done on the theme's side. However, there are solid plugins like redhat.java
that provides extended Java support, including what's known as semantic highlighting. Such services provide themes with "understandings" of your code, so the highlighting would be more accurate.
Dark Plus Darcula fully supports semantic highlighting. Here's how your code would be colored using theme v1.2.0, without semantic highlighting (editor default):
With semantic highlighting (using redhat.java
):
@Herman0802 I believe there is no extra settings for the extension in my VS Code. I installed the extension, and it works out of the box :p
@Herman0802 Hey could you try providing the token info of the uncolored enum members? Here's how:
- open your source file and see the bug reporduce
- open command palette by pressing Ctrl (Command) + Shift + P
- enter
tokens
after the ">" symbol, and select "Developer: Inspect Editor Tokens and Scopes" - there will be a popup that follows your cursor; click on the uncolored enum members in your source file
- see the token show up in the popup, paste me the following information that it gives (all, if multiple items in one category):
- semantic token type (if exists)
- modifiers (if exists)
- textmate token
- textmate scopes
Thanks, it will help me fix your specific problem.