Module of PsiElement in dependency

Answered

Hello everyone,

I'm developing a custom language plugin and I am stuck resolving references across dependencies.

The test project has a dependency to another project, and references an element of this dependency.
This works, however, the resolve in the read-only file of the dependency does not work.

For project files the following works:

ProjectRootManager.getInstance (element.getProject()) .getFileIndex () .getModuleForFile (element.getContainingFile ().getVirtualFile ());

However, if element is an PsiElement inside a dependency, then the module is null.
How can I get the module content of such an element?

0
1 comment

Hi,

Could you please provide more information? What does it mean that a project depends on another project? What are read-only files? Where the code you pasted is executed?

Ideally, please provide a reproducible example of the case.

0

Please sign in to leave a comment.