Extending language support to understand foreign language RPC bindings.

Answered

Where I work we have a mixed java backend, typescript frontend code base, and we autogenerate rpc bindings the frontend typescript code can use to call the strongly typed backend methods. I'd like to make a plugin that helps IntelliJ realize that the bindings are a usage of the java methods they are were generated from. We have similar bindings for classes returned by java methods; we generate interfaces for the arguments used.

Is there a way to add that correspondence at the lowest level? Some way I could plugin to the typescript PSI elements and tell IntelliJ where the corresponding source java PSI element is?

Currently, I have a FindUsageSearcher that checks to see if the PSIElement that's the subject of the search has a corresponding element in the other language, and if so, constructs and runs a find usages provider for that language, adding the results to the initial request, yielding usage results in both Java and Typescript. I've also implemented a custom ImplementationSearcher. 

Is there anything I'm missing, and is there a better way?

0
1 comment

Is your solution not working or complete like this? Eventually PsiReference could also be used https://plugins.jetbrains.com/docs/intellij/references-and-resolve.html and for navigation Gutter Icons https://plugins.jetbrains.com/docs/intellij/line-marker-provider.html

0

Please sign in to leave a comment.