How do I resolve PsiReference during indexing?

Or can I check if reference links to PsiClass?

0
4 comments
Official comment

During indexing, you can only depend on the file content. So you can only resolve references if they point inside the same file. The index can't depend on any other file in the project, so you shouldn't depend on inter-file resolve result in your index, otherwise the index can't be properly rebuilt on changes.

Avatar
Permanently deleted user

Thank you. Last thing I want to clarify if I want to resolve local reference I just have to wrap reference.resolve() with try catch to avoid IndexNotReadyException or there is more correct way to do this?

0

Ideally, you'd call some other code that explicitly walks only the current file and doesn't even attempt to look into other files.

0
Avatar
Permanently deleted user

If you want to avoid the IndexNotReady exception (because the project is indexing), you can call DumbService.isDumb(project);

0

Please sign in to leave a comment.