# Why my Symbol reference is unidirectional (no usages)?

**URL:** <https://platform.jetbrains.com/t/why-my-symbol-reference-is-unidirectional-no-usages/673>\
**Category:** IntelliJ Platform\
**Created:** [February 24, 2025, 12:41pm UTC](https://platform.jetbrains.com/t/why-my-symbol-reference-is-unidirectional-no-usages/673 "2025-02-24T12:41:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcin.xvsg](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/marcin.xvsg/32/311_2.png) [@marcin.xvsg](https://platform.jetbrains.com/u/marcin.xvsg)\
**Post date:** [February 24, 2025, 12:41pm UTC](https://platform.jetbrains.com/t/why-my-symbol-reference-is-unidirectional-no-usages/673/1 "2025-02-24T12:41:11Z")

</div>

I’ve created TypeScript to Java Symbol reference which matches service calls by class and method names. It works perfectly TS → Java way, but then in Java file I see “No usages”

I’ve implemented:  
`NavigatableSymbol`, `PsiSymbolReference` and `PsiSymbolReferenceProvider`

Our symbols implementation might be found here:

> **[intellij-plugin/plugin/src/main/kotlin/com/vaadin/plugin/symbols at main ·...](https://github.com/vaadin/intellij-plugin/tree/main/plugin/src/main/kotlin/com/vaadin/plugin/symbols)**
>
> Vaadin IntelliJ Plugin. Contribute to vaadin/intellij-plugin development by creating an account on GitHub.

What should I do more to see usages of Java class methods?

---

<div class="post-metadata">

**Author:** ![maxmedvedev](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/maxmedvedev/32/2954_2.png) [@maxmedvedev](https://platform.jetbrains.com/u/maxmedvedev)\
**Post date:** [March 24, 2025, 12:24am UTC](https://platform.jetbrains.com/t/why-my-symbol-reference-is-unidirectional-no-usages/673/3 "2025-03-24T00:24:48Z")

</div>

Hey Marcin,

Find usage machinery checks only those references that are provided by implementations of so-called reference searchers.  
The idea is that if you are looking for references of a class `Foo`, you basically need to search for all text occurrences of `Foo` in all source files and check if each occurrence has a reference to `Foo` class. But Java reference searchers do not look into non-Java files, and it’s the responsibility of the plugin to provide a searcher that consumes all potential occurrences in other languages.  
See `com.intellij.psi.impl.search.JavaRecordComponentSearcher` as an example.

---

<div class="post-metadata">

**Author:** ![marcin.xvsg](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/marcin.xvsg/32/311_2.png) [@marcin.xvsg](https://platform.jetbrains.com/u/marcin.xvsg)\
**Post date:** [March 28, 2025, 10:53am UTC](https://platform.jetbrains.com/t/why-my-symbol-reference-is-unidirectional-no-usages/673/4 "2025-03-28T10:53:13Z")

</div>

Thank you for reply, first issue encountered: why it does not list methods?

 ![image](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/2X/d/d5ab7eb5e7f21730d4f60b92e84275c9525432d5.png)

After clicking around I got only what’s on screenshot. Selecting method results in PsiParameter being found only, and only if method has any parameters. Selecting non params method does nothing…

---

<div class="post-metadata">

**Author:** ![marcin.xvsg](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/marcin.xvsg/32/311_2.png) [@marcin.xvsg](https://platform.jetbrains.com/u/marcin.xvsg)\
**Post date:** [March 28, 2025, 11:00am UTC](https://platform.jetbrains.com/t/why-my-symbol-reference-is-unidirectional-no-usages/673/5 "2025-03-28T11:00:50Z")

</div>

Using `methodReferencesSearch` instead worked.

---

<div class="post-metadata">

**Author:** ![marcin.xvsg](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/marcin.xvsg/32/311_2.png) [@marcin.xvsg](https://platform.jetbrains.com/u/marcin.xvsg)\
**Post date:** [March 28, 2025, 12:04pm UTC](https://platform.jetbrains.com/t/why-my-symbol-reference-is-unidirectional-no-usages/673/6 "2025-03-28T12:04:31Z")

</div>

Managed to make it work, if someone is looking for Java → TypeScript (TSX) reference searcher:

```java
class HillaReferenceSearcher : QueryExecutorBase<PsiReference, MethodReferencesSearch.SearchParameters>() {

    override fun processQuery(queryParameters: MethodReferencesSearch.SearchParameters, consumer: Processor<in PsiReference>) {
        val element = queryParameters.method

        val searchHelper = PsiSearchHelper.getInstance(queryParameters.project)
        val scope = GlobalSearchScope.projectScope(queryParameters.project)
        val typeScriptFileType = TypeScriptJSXFileType.INSTANCE

        val filteredScope = GlobalSearchScope.getScopeRestrictedByFileTypes(scope, typeScriptFileType)
        searchHelper.processElementsWithWord(
            { psiElement, offset ->
                if (psiElement.elementType == JSElementTypes.REFERENCE_EXPRESSION) {
                    val range = TextRange(offset, offset + element.name.length)
                    val reference = object : PsiReferenceBase<PsiElement>(psiElement, range) {
                        override fun resolve(): PsiElement = psiElement
                    }
                    consumer.process(reference)
                }
                true // return false to stop the search early
            },
            filteredScope,
            element.name,
            UsageSearchContext.IN_CODE,
            true
        )

    }

}

```

If you spot any errors in above please add comment.
