Open vogella opened 1 year ago
This screenshot shows semantic highlighting is not enabled in your VS Code instance. You get the default textmate grammar look. Imports should be green in dark mode:
Make sure you start vscode-java in Standard mode.
my screenshot is from the Eclipse client
@mickaelistria could also reprodude in Vscode
My screenshot is from VS Code, which I know works as expected. I strongly suspect LSP4E still.
@fbricon your test doesn't work because the javax.inject seems to not be resolved, so JDT-LS doesn't know it's an annotation and doesn't apply the token type. If you wish to reproduce it on vscode, try this
import java.lang.annotation.Documented;
@Documented
public class c {
}
which renders as (in VSCode light theme)
@mickaelistria no that's a feature of the Solarized Light theme in VS Code, which highlights those tokens differently. You can try the standard Dark or Light+ themes, the highlighting looks as you'd expect.
So you confirm it's JDT-LS sending a different token type for annotations in import? This is the topic of this bug I believe. And I do see it on dark theme in VSCode as well
it sends an annotation token, but there's no issue with annotation highlightings on my side: (See "Developer: Inspect Editor Tokens and Scopes" command)
Yeah, as shown in the screenshot above, JDT LS does (intentionally) send a different token type for annotations, enums, interfaces etc, regardless of whether or not it is in an import declaration. This is done to provide maximum flexibility for theme authors, so that they have the option to differentiate between classes, enums, annotations, interfaces etc. even inside import declarations.
If you want all the tokens inside the import declaration to be the same color (like in the default Eclipse dark theme), you need to add a rule to your theme which applies that color to all tokens with the importDeclaration
modifier (which is set for all tokens inside import declaration statements). I made a theme (extension: https://marketplace.visualstudio.com/items?itemName=zerodind.familiar-java-themes) which tries to replicate the default Eclipse dark theme in VSCode, you can see how I differentiate between annotation tokens inside vs outside import declarations here: https://gitlab.com/zerodind/familiar-java-themes/-/blob/7ff7cdb66aa5b0799475fe866af3ff4de3b66698/themes/eclipse-dark-color-theme.json#L381-388
Later on, I actually got a merge request from somone who wanted to change the Eclipse theme dark theme to differentiate between different types in the import statements (which ended up being implemented as a second variant of the Eclipse dark theme): https://gitlab.com/zerodind/familiar-java-themes/-/merge_requests/1
In fact, they were surprised to learn that Eclipse just colors everything inside the import declaration white by default: https://gitlab.com/zerodind/familiar-java-themes/-/merge_requests/1#note_1059243221
Anyways, the conclusion is that you'll need to add/change some rules to your theme in order to take the importDeclaration
modifier into account, if you want annotations etc. to have a different color when they are outside vs inside an import declaration. Let me know if that makes sense to you or not.
Using latest from https://redhat-developer.github.io/eclipseide-jdtls and opening StackRendererTest from eclipse.platform.ui
The "Inject" is incorrect highlighted.
The same issue can be reproduced with vscode-java;
See https://github.com/redhat-developer/eclipseide-jdtls/issues/56 for the first report.