redhat-developer / redhat-developer/lsp4ij
"Find Usages" does not work for `LSPSemanticTokenElementType.DECLARATION`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 344
- Forks
- 113
- Avg merge
- 5h 22m
- Merged PRs (30d)
- 15
Description
At the moment, elements with type LSPSemanticTokenElementType.DECLARATION are not handled correctly by the "Find Usages" functionality.
As a result, it is impossible to invoke "Find Usages" for a class (or other declarations) that are recognized as DECLARATION type.
Actual behavior
- I have a class defined in the project.
- When trying to invoke Find Usages on it, the action does not work.
- Investigation shows that the element is recognized as
LSPSemanticTokenElementType.DECLARATION, and the current logic does not support this case.
Expected behavior
- "Find Usages" should work correctly for elements with
LSPSemanticTokenElementType.DECLARATION. - Classes and other declarations should be searchable as usage targets.
Tech notes:
The logic is here:
com.redhat.devtools.lsp4ij.features.semanticTokens.viewProvider.LSPSemanticTokensSingleRootFileViewProvider#getSemanticTokenReference
protected @Nullable PsiReference getSemanticTokenReference(int offset) { LSPSemanticToken semanticToken = this.isEnabled() ? this.getSemanticToken(offset) : null; LSPSemanticTokenElementType elementType = semanticToken != null ? semanticToken.getElementType() : null; return elementType == LSPSemanticTokenElementType.REFERENCE ? new LSPSemanticTokenPsiReference(semanticToken) : null; }
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at com.redhat.devtools.lsp4ij.features.semanticTokens.viewProvider.LSPSemanticTokensSingleRootFileViewProvider#getSemanticTokenReference and inspect how semantic token element types become PSI references. Reproduce Find Usages for a class or declaration recognized as LSPSemanticTokenElementType.DECLARATION, then verify that declarations are searchable as usage targets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools, search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100