Comment actions Permalink


Your project seems to be incomplete so it is hard to understand what's the issue. I agree with Yann that it is probably a misconfiguration of the project or test project. I suggest digging deeper into this topic by looking at other plugins or other forum questions, e.g.:

If everything is configurated correctly and the problem still happens, I suggest inspecting the PSI of the file you test and making sure that resolvable references are exactly in the elements you try to resolve. Open the PSI Viewer:

and make sure that PsiMethodCallExpression element contains references in the References tab. It may happen that reference is actually in the element's parent or child and you just use the wrong element to resolve it.

Comment actions Permalink

Hi Karol

I have open the PSI Viewer ,Invoker1.java ’s  and Invoker2.java‘s  PSI are normal in the Intelij IDEA.

This problem may only occur in `myFixture.AddFileToProject` PsiFile returns, if I add multiple files, their references don't seem to be related.

In particular, `import static` or  invoke static methods

check out my debug console output   https://github.com/liaohang122/psitest/blob/main/debug.png



Comment actions Permalink

What does it mean that PSI is normal? Are there references in the PsiMethodCallExpression elements? Could you please share a screenshot of the PSI Viewer showing references?

Comment actions Permalink

Hi Karol, thks for your reply

I solved the problem.  the method addFileToProject first parameter is a String,it must contains package path.  and then resolve is ok.

I'm not sure what the first parameter means, but it work now

PsiFile invoker1PsiFile = this.myFixture.addFileToProject("com/Invoker1.java",Invoker1Content);
PsiFile invoker2PsiFile = this.myFixture.addFileToProject("com/Invoker2.java",Invoker2Content);

Please sign in to leave a comment.