Closed ianp closed 6 years ago
After the last commit, imports are now foldable as well 😀
Thanks for your effort, I'll have a look at this after Christmas.
I'm getting uncaught exceptions when I tried to create a new module:
java.lang.NullPointerException
at com.intellij.codeInsight.folding.impl.FoldingUpdate.getFoldingsFor(FoldingUpdate.java:244)
at com.intellij.codeInsight.folding.impl.FoldingUpdate.getFoldingsFor(FoldingUpdate.java:229)
at com.intellij.codeInsight.folding.impl.FoldingUpdate.getUpdateResult(FoldingUpdate.java:116)
at com.intellij.codeInsight.folding.impl.FoldingUpdate.access$000(FoldingUpdate.java:55)
at com.intellij.codeInsight.folding.impl.FoldingUpdate$1.compute(FoldingUpdate.java:104)
at com.intellij.codeInsight.folding.impl.FoldingUpdate$1.compute(FoldingUpdate.java:99)
at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:53)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:65)
at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:43)
at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:97)
at com.intellij.codeInsight.folding.impl.FoldingUpdate.updateFoldRegions(FoldingUpdate.java:98)
at com.intellij.codeInsight.folding.impl.CodeFoldingManagerImpl.updateFoldRegions(CodeFoldingManagerImpl.java:335)
at com.intellij.codeInsight.folding.impl.CodeFoldingManagerImpl.updateFoldRegionsAsync(CodeFoldingManagerImpl.java:320)
at com.intellij.codeInsight.daemon.impl.CodeFoldingPass.doCollectInformation(CodeFoldingPass.java:42)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:70)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$0(PassExecutorService.java:434)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1026)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:427)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:426)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:402)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:154)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
I'm also getting some parser errors which are probably caused by the exceptions above.
OK, sounds like there are some issues with this PR as it stands. I should get some time to take a look into this over the next few days.
Would love to see this merged @ianp :)
Thank you in your interest in the plugin. I'm sorry to say that this repository is no longer maintained due to lack of resources. If you need an Elm language support in IntelliJ - please consider using this plugin instead.
@durkiewicz thank you for your work on the plugin. I converted over from sublime text at the time because this plugin had much more features in comparison and it's really helped both my work and hobby projects.
Fixes durkiewicz/elm-plugin#29. So far support is in place for folding value declarations, case expressions, and case branches.
It doesn't currently fold the list of import statements, or comments, as I'd like to discuss how best to approach that. It seems like the preferred approach would be to alter the AST so that there is a parent node which represents the list of imports, ditto for block comments. So for imports making a change like this (to
Elm.bnf
)but I'm not currently sure how this would impact the import intention action.