Resolving Reference Outside of the Current File
I am trying to implement reference resolution for identifiers that are defined in other files either in the project or in libraries.
Does anyone have a good example of how to implement this?
Please sign in to leave a comment.
Hi Jon,
I have an example at:
https://github.com/cmf/schemely/blob/master/src/schemely/psi/impl/SchemeFile.java (see the resolve method).
Disclaimers: the code is pretty rough, and I'm using custom resolution, not Java-style ScopeProcessor type resolution - I have a todo to fix this. I use this in my plugin to provide resolution to stubs for external APIs (Scheme R5RS in this case). I provide stubs in the plugin jar which provide the psi elements to refer to - this code will show you how to create references to these types of elements, but I imagine other types of elements are pretty similar. This is based on a discussion I had with Dmitry here: javascript:;
Let me know if you have any questions.
Cheers,
Colin
Edit: fixed link after project reorganisation
Here's a relative post: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206767925-Resolving-Reference-over-the-whole-PSI-tree-speed-optimization-
This is the relative part in the SDK doc: http://www.jetbrains.org/intellij/sdk/docs/basics/indexing_and_psi_stubs/file_based_indexes.html
Hope these are helpful.