Inconsistent behavior when building structureview in intellij and pycharm

Hi,


I'm the author of r4intellij. I've implemented the structure view as suggested in the manual. See here for the code. It works well in intellij itself, however users of pycharm (same for webstorm) reported the following NPE:

java.lang.NullPointerException
at com.intellij.ide.structureView.TextEditorBasedStructureViewModel.(TextEditorBasedStructureViewModel.java:60)
at com.r4intellij.psi.RScriptStructureViewFactory$RStructureViewModel.(RScriptStructureViewFactory.java:75)
at com.r4intellij.psi.RScriptStructureViewFactory$1.createStructureViewModel(RScriptStructureViewFactory.java:51)
at com.intellij.ide.structureView.TreeBasedStructureViewBuilder.createStructureView(TreeBasedStructureViewBuilder.java:50)
at com.intellij.ide.impl.StructureViewWrapperImpl.rebuild(StructureViewWrapperImpl.java:315)
at com.intellij.ide.impl.StructureViewWrapperImpl$6.run(StructureViewWrapperImpl.java:253)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:2350)

It seems that the psiFile provided by the WebStorm to my PsiStructureViewFactory implmementation is null. Since it is perfectly fine for the plugin-in idea, I don't know how to track down the problem. Do you have any ideas?

Both windows and macos are affected, so it's more likely to be a classpath/openapi versioning issue.

Thank you,
best regards,
Holger Brandl

1 comment
Comment actions Permalink

This is a bug in PyCharm. As a workaround, please use the constructor of TextEditorBasedStructureViewModel that takes two parameters (Editor and PsiFile).


0

Please sign in to leave a comment.