Get file PSI in jps plugin thread

Answered
In my builder in jps thread, i have a file path. How can i get the psi of the file here? I have tried with: VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath); But it throws "java.lang.ClassNotFoundException: com.intellij.util.messages.Topic
5 comments
Comment actions Permalink

Please clarify what you want to achieve

0
Comment actions Permalink

The language of the file (not java) i am working on, it can be such that its filename is not same as content module/class name.
In jps builder, we have listed all the source files, and have a module/class name stored in the project module.
So, i would like to be able to open each file, gets its associated psi tree info, and get the psi module/class declaration identifier to match.

If not able to do the above, i assume the only method left then is perform psi matching in ide process first, and then pass the result to jps builder via a data key value method instead?

0
Comment actions Permalink

JPS has no access to PSI/VFS, so you'll need to pass such data between the two worlds

1
Comment actions Permalink

Thanks for this clarification.

0
Comment actions Permalink

Addendum:

It is possible to pass initial data in the form of BuilderParameters: all userData from com.intellij.openapi.compiler.CompileScope is available in the JPS build as a BuildParameter from org.jetbrains.jps.incremental.CompileContext.getBuilderParameter()

0

Please sign in to leave a comment.