lppedd / idea-conventional-commit

Context and template-based completion for conventional/semantic commits.
https://plugins.jetbrains.com/plugin/13389-conventional-commit
MIT License
327 stars 19 forks source link

Exception on Auto-Suggest :: PhpStorm / Commit Changes screen #31

Closed travisseitler closed 3 years ago

travisseitler commented 4 years ago

When writing a commit message in PhpStorm, I get the following error any time the auto-suggest list for types or footerTypes appears. (I've checked this a few times, and the only difference I've seen is the line number reference for ensureItemIterator (I've see Sequences.kt:269 and Sequences.kt:278.)

java.lang.ClassCastException: class com.github.lppedd.cc.parser.InvalidToken cannot be cast to class com.github.lppedd.cc.parser.ValidToken (com.github.lppedd.cc.parser.InvalidToken and com.github.lppedd.cc.parser.ValidToken are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @11f0a234)
    at com.github.lppedd.cc.api.DefaultCommitTokenProvider$getFooterValues$4.invoke(DefaultCommitTokenProvider.kt:97)
    at com.github.lppedd.cc.api.DefaultCommitTokenProvider$getFooterValues$4.invoke(DefaultCommitTokenProvider.kt:25)
    at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:133)
    at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:156)
    at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
    at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:131)
    at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:156)
    at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
    at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
    at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:131)
    at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:156)
    at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:278)
    at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:265)
    at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
    at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:716)
    at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:746)
    at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:737)
    at com.github.lppedd.cc.api.DefaultCommitTokenProvider.getCommitFooterValues(DefaultCommitTokenProvider.kt:77)
    at com.github.lppedd.cc.completion.providers.FooterValueCompletionProvider$complete$1$1.invoke(FooterValueCompletionProvider.kt:44)
    at com.github.lppedd.cc.completion.providers.FooterValueCompletionProvider$complete$1$1.invoke(FooterValueCompletionProvider.kt:27)
    at com.github.lppedd.cc.CCExtensionsKt$sam$i$java_util_concurrent_Callable$0.call(CCExtensions.kt)
    at com.intellij.openapi.application.ex.ApplicationUtil.lambda$null$1(ApplicationUtil.java:62)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:625)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:570)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.openapi.application.ex.ApplicationUtil.lambda$runWithCheckCanceled$2(ApplicationUtil.java:60)
    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:255)
    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.lang.Thread.run(Thread.java:834)

I don't know if this would be helpful (say, if the issue is specific to my setup in some way), but here are the contents of my Help > About screen:

PhpStorm 2020.1
Build #PS-201.6668.153, built on April 13, 2020
Runtime version: 11.0.6+8-b765.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.3.0-59-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 2014M
Cores: 4
Registry:
    run.processes.with.pty=TRUE,
    debugger.valueTooltipAutoShowOnSelection=true,
    localHistory.daysToKeep=30,
    ide.tooltip.initialDelay=209,
    ide.balloon.shadow.size=0
Non-Bundled Plugins:
    com.github.lppedd.idea-conventional-commit,
    ru.adelf.idea.dotenv,
    me.mbolotov.cypress,
    intellij.prettierJS
Current Desktop: KDE
lppedd commented 4 years ago

Pretty strange! But I will test on the exact same version of PhpStorm to verify! Thanks for the report!

lppedd commented 4 years ago

Could you also try a previous version of the plugin? It should be 0.15.0

travisseitler commented 4 years ago

I just checked with 0.15.0 and I get the same exception. The only difference is in the first line:

0.15.0:

java.lang.ClassCastException: class com.github.lppedd.cc.parser.InvalidToken cannot be cast to class com.github.lppedd.cc.parser.ValidToken (com.github.lppedd.cc.parser.InvalidToken and com.github.lppedd.cc.parser.ValidToken are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @692dbfba)

0.15.1:

java.lang.ClassCastException: class com.github.lppedd.cc.parser.InvalidToken cannot be cast to class com.github.lppedd.cc.parser.ValidToken (com.github.lppedd.cc.parser.InvalidToken and com.github.lppedd.cc.parser.ValidToken are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @11f0a234)

...but I'm not sure if that's relevant. It almost looks like it could just be an internal reference to the installed plugin (and if that's the case, I'd expect it to be different for each install).

That said, I also just tried the same thing with 1.14.0 and I do not get an exception there. Progress?! :smile:

lppedd commented 3 years ago

Fixed with commit 54bb971747ec9ead95c54550f7b52b4a10f961ae.
Thanks!

lppedd commented 3 years ago

@travisseitler hey! Did you notice crashes again?

travisseitler commented 3 years ago

@lppedd I haven't noticed any crashes, and the autocomplete seems more snappy overall. 😄