Open raulvaldoleiros opened 1 week ago
There's a few workarounds / other ways to achieve something similar, though I guess this is definitely something that could be done, given that we have the data from reference code lens (ie. 0 references), and could just use the semantic highlighting on the language server side to correctly set the highlighting.
Using java.referencesCodeLens.enabled: true
(assuming editor.codeLens: true
is also set), you would see 0 references
over any method declaration that is not referenced anywhere.
For private methods only (a little simpler because they need not be searched throughout the entire project), there's :
.vscode/settings.json
{
"java.settings.url": ".vscode/settings.prefs",
}
settings.prefs
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
Hi @rgrunber,
Thanks for the update.
For private methods sonarlint shows a warning message and change the method color to grey.
For non-private methods the referencesCodeLens shows there isn't references but don't change the method color.
I will use your suggestion for referenceCodeLens, thanks 👍 IMHO this improvement should be considerer for your future backlog.
It would be great if vscode java changed the color method, maybe to grey, on methods without any reference to it.
Similar to what intellij have.