ncsaba / idea-openscad

OpenSCAD language plugin for the IntelliJ platform.
Apache License 2.0
28 stars 10 forks source link

NullPointerException In Intellij #59

Closed johnnyclark closed 3 years ago

johnnyclark commented 3 years ago

First of all thanks for writing the plugin, it is very helpful. The following problem is not a big deal, and this issue is really just my attempt to help out with the plugin. The exception appears in Intellij's IDE Fatal Errors popup, which doesn't exactly provide a big visual alert, so I'm not sure when this is occuring. I'll continue to keep an eye out and see if I can figure out how to replicate. Given that it's a NPE I thought it MIGHT be easy to see in the code.

java.lang.NullPointerException at com.javampire.openscad.completion.OpenSCADCompletionContributor$1.addCompletions(OpenSCADCompletionContributor.java:85) at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:32) at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155) at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:77) at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:154) at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:146) at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:142) at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:88) at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:32) at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155) at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:77) at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:60) at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:133) at com.intellij.codeInsight.completion.BaseCompletionService.performCompletion(BaseCompletionService.java:41) at com.intellij.codeInsight.completion.CompletionProgressIndicator.lambda$calculateItems$12(CompletionProgressIndicator.java:862) at com.intellij.util.indexing.FileBasedIndex.lambda$ignoreDumbMode$0(FileBasedIndex.java:179) at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111) at com.intellij.util.indexing.FileBasedIndexEx.ignoreDumbMode(FileBasedIndexEx.java:543) at com.intellij.util.indexing.FileBasedIndex.ignoreDumbMode(FileBasedIndex.java:178) at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:858) at com.intellij.codeInsight.completion.CompletionProgressIndicator.runContributors(CompletionProgressIndicator.java:846) at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$6(CodeCompletionHandlerBase.java:353) at com.intellij.codeInsight.completion.AsyncCompletion.lambda$tryReadOrCancel$5(CompletionThreading.java:172) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1137) at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:170) at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$7(CodeCompletionHandlerBase.java:345) at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$0(CompletionThreading.java:95) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165) at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91) at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20) at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11) at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:270) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665) at java.base/java.lang.Thread.run(Thread.java:834)

SmoothieAq commented 3 years ago

I just started to use the plugin again after a long break - lots of awesome fixes in this new version! But I do get quite a few exceptions in the IntelliJ log, I seem to recall something like this, but also other errors. My loose guess is, that the errors (mostly?) comes from the parsing of OpenSCAD programs or libraries. I will also look out for some patterns, although some of it may be because of the still-open issues.

ldenisey commented 3 years ago

Hello,

Thank you for the feedback. Indeed we have some issues with our autocompletion code. We may need to rethink the parsing to make completion easier to analyze. Don't hesitate to send code snippet that fails when you target them.

ldenisey commented 3 years ago

Hello, I have added a check in d8258f63cee96cd520b328fb0b029c39b6d7be16. Will be released in next version. Please open a new issue if you encounter other NPE exceptions.