eclipse.jdt.ls
eclipse.jdt.ls copied to clipboard
question: semantic highlighting, assign each parameter or variable its own color
can jdtls do semantic highlighting assign each parameter or variable its own color?
Thanks!
I think it's not supported yet. Is that true? @Eskibear
Semantic highlighting is already supported, and jdtls will report tokens and corresponding modifiers to clients. Color themes will recognize and colorize them.
Not sure what do you mean by "its own color", but if you want to override color theme and customize color of tokens/modifiers by your own, you can use setting editor.semanticTokenColorCustomizations
.
See https://code.visualstudio.com/docs/getstarted/themes#_editor-semantic-highlighting
![Screen Shot 2022-06-20 at 11 07 21](https://user-images.githubusercontent.com/41779116/174518288-01a1822e-48fc-40ad-85da-b2ecbb527bd3.png)
@Eskibear Hi Please see the example, it colors each parameter in a different color.
Like I mentioned above, LS is responsible for reporting correct token type and modifier information, and theme authors are responsible for colorization based on the information. For example, they are able to differentiate field members and local variables using styling.
In your screenshot, is the color corresponding to type of the variable, or its position of the parameter list? What if I have tens of parameters defined in a method, will they all be colorized differently? Anyway, personally, this feature request doesn't make much sense to me, more like a noise to me.
In your screenshot, is the color corresponding to type of the variable, or its position of the parameter list? What if I have tens of parameters defined in a method, will they all be colorized differently?
yes, 10 parameters will be colored differently. It's the behavior of semantic highlighting in IntelliJ.