Stub index builder for compiled files
Hello,
I wrote a custom language plugin with ability to decompile binary files. It works via filetype.decompiler extension point and I can open a compiled file and see the source code.
I'd like to build stub indices for the compiled files.
As I can see there is psi.classFileDecompiler extension point and ClassFileDecompilers.Full base class.
The getStubBuilder() method doesn't get called unless filetype.stubBuilder extension point is also used.
But what should I put in my implementation of ClsStubBuilder?
At first sight I can decompile the file to source code or PSI tree and call some stub builder class (DefaultStubBuilder?) to build the tree.
But it doesn't seem to be the case.
If the compiled file class doesn't implement PsiFileWithStubSupport I get the following message:
"Stub index points to a file with PSI stubs (instead of non-PSI ones)"
What is "non-PSI stubs"?
If the file class does implement PsiFileWithStubSupport stub tree seems to build but on it's usage attempt it fails at the following line in StubBasedPsiElementBase class:
PsiFileImpl file = (PsiFileImpl)getContainingFile();
as the containing file is not a PsiFileImpl but LightPsiFileBase. The same error appears even if I create stub tree by hand.
What is the right way to build stub tree for decompiled files?
Please sign in to leave a comment.
The problem was in base class of compiled psi file. It should be PsiFileBase, not LightPsiFileBase.