Proper way to obtain ResolveCache instance
Hi all,
how shall I obtain ResolveCache in my PsiReferenceResolver ?
Via psi element - file - project - static method or via ServiceManager.getService(ResolveCache.class) ?
Or is there some nice dependency injection mechanism?
Please sign in to leave a comment.
All three of those will work. If you have a project component, project service or an extension in a project-scoped extension point, and if you add a parameter of type ResolveCache to your constructor, the instance will be injected.
Tried it:
registeres as;
Source:
I thought reference constributor is project extension poing....
No, this is an application level extension. To check this, you can find the extension point declaration in the CE source code (LangExtensionPoints.xml in this case) and check whether its area is set to IDEA_PROJECT.