cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
574 stars 7 forks source link

Frequent exception when working with Rama #2869

Closed jdhollis closed 2 months ago

jdhollis commented 5 months ago

Started working with Rama recently, and I’m seeing consistent Cursive exceptions when typing the various macros (most noticeably defmodule):

java.lang.NullPointerException: Cannot invoke "com.intellij.psi.PsiElement.getPrevSibling()" because "this.element" is null
    at cursive.psi$prev_siblings$fn__18775.invoke(psi.clj:365)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:593)
    at clojure.core$seq__5467.invokeStatic(core.clj:139)
    at clojure.core$filter$fn__5962.invoke(core.clj:2826)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:593)
    at clojure.core$seq__5467.invokeStatic(core.clj:139)
    at clojure.core$take_while$fn__5986.invoke(core.clj:2921)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:593)
    at clojure.core$seq__5467.invokeStatic(core.clj:139)
    at clojure.core$seq__5467.invoke(core.clj:139)
    at cursive.metadata$from.invokeStatic(metadata.clj:84)
    at cursive.metadata$from.invoke(metadata.clj:79)
    at cursive.extensions.clojure.core.resolve$global_var_meta.invokeStatic(resolve.clj:138)
    at cursive.extensions.clojure.core.resolve$global_var_meta.invoke(resolve.clj:128)
    at cursive.index$with_parsed2.invokeStatic(index.clj:651)
    at cursive.index$with_parsed2.invoke(index.clj:649)
    at cursive.extensions.rama$fn__11675.invokeStatic(rama.clj:248)
    at cursive.extensions.rama$fn__11675.invoke(rama.clj:248)
    at cursive.resolve.light$update_state$fn__17532.invoke(light.clj:128)
    at clojure.core.protocols$iter_reduce.invokeStatic(protocols.clj:49)
    at clojure.core.protocols$fn__8230.invokeStatic(protocols.clj:75)
    at clojure.core.protocols$fn__8230.invoke(protocols.clj:75)
    at clojure.core.protocols$fn__8178$G__8173__8191.invoke(protocols.clj:13)
    at clojure.core$reduce.invokeStatic(core.clj:6886)
    at clojure.core$reduce.invoke(core.clj:6868)
    at cursive.resolve.light$update_state.invokeStatic(light.clj:122)
    at cursive.resolve.light$update_state.invoke(light.clj:114)
    at cursive.resolve.light$process_top_level_lists$process__17559.invoke(light.clj:203)
    at cursive.resolve.light$process_top_level_lists.invokeStatic(light.clj:231)
    at cursive.resolve.light$process_top_level_lists.invoke(light.clj:178)
    at cursive.resolve.light$clj_resolve_states.invokeStatic(light.clj:240)
    at cursive.resolve.light$clj_resolve_states.invoke(light.clj:239)
    at cursive.psi$cached_value$reify__18883.compute(psi.clj:565)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:37)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:66)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:27)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:69)
    at cursive.psi$cached_value.invokeStatic(psi.clj:568)
    at cursive.psi$cached_value.doInvoke(psi.clj:555)
    at clojure.lang.RestFn.invoke(RestFn.java:445)
    at cursive.resolve.light$resolve_states.invokeStatic(light.clj:246)
    at cursive.resolve.light$resolve_states.invoke(light.clj:245)
    at cursive.index$process_file.invokeStatic(index.clj:46)
    at cursive.index$process_file.invoke(index.clj:45)
    at cursive.index$index_with.invokeStatic(index.clj:83)
    at cursive.index$index_with.invoke(index.clj:72)
    at cursive.index$index_with.invokeStatic(index.clj:74)
    at cursive.index$index_with.invoke(index.clj:72)
    at cursive.index$file_namespaces.invokeStatic(index.clj:292)
    at cursive.index$file_namespaces.invoke(index.clj:289)
    at clojure.lang.Var.invoke(Var.java:384)
    at cursive.api.DelayedFn.invoke(DelayedFn.java:31)
    at cursive.psi.impl.ClojureFileImpl$NamespacesProvider.compute(ClojureFileImpl.java:162)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:37)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:66)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:27)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:69)
    at cursive.psi.impl.ClojureFileImpl.getAllNamespaces(ClojureFileImpl.java:176)
    at cursive.psi.impl.ClojureFileImpl.getNs(ClojureFileImpl.java:123)
    at cursive.psi.impl.ClojureFileImpl.getNamespace(ClojureFileImpl.java:118)
    at cursive.navigation.ClojureEditorTabTitleProvider.getEditorTabTitle(ClojureEditorTabTitleProvider.java:33)
    at com.intellij.openapi.fileEditor.impl.EditorTabPresentationUtil.getCustomEditorTabTitle(EditorTabPresentationUtil.kt:22)
    at com.intellij.openapi.fileEditor.impl.EditorTabPresentationUtil.getEditorTabTitle(EditorTabPresentationUtil.kt:14)
    at com.intellij.openapi.fileEditor.impl.EditorsSplitters$updateFileName$title$1.invoke(EditorsSplitters.kt:471)
    at com.intellij.openapi.fileEditor.impl.EditorsSplitters$updateFileName$title$1.invoke(EditorsSplitters.kt:470)
    at com.intellij.openapi.application.rw.InternalReadAction.insideReadAction(InternalReadAction.kt:108)
    at com.intellij.openapi.application.rw.InternalReadAction.access$insideReadAction(InternalReadAction.kt:16)
    at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:95)
    at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:94)
    at com.intellij.openapi.application.rw.CancellableReadActionKt$cancellableReadActionInternal$1.invoke$lambda$1$lambda$0(cancellableReadAction.kt:38)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1075)
    at com.intellij.openapi.application.rw.CancellableReadActionKt$cancellableReadActionInternal$1.invoke$lambda$1(cancellableReadAction.kt:36)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:73)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:128)
    at com.intellij.openapi.application.rw.CancellableReadActionKt$cancellableReadActionInternal$1.invoke(cancellableReadAction.kt:34)
    at com.intellij.openapi.progress.CoroutinesKt.blockingContextInner(coroutines.kt:321)
    at com.intellij.openapi.progress.CoroutinesKt.blockingContext(coroutines.kt:310)
    at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal(cancellableReadAction.kt:31)
    at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable(InternalReadAction.kt:94)
    at com.intellij.openapi.application.rw.InternalReadAction.tryReadAction(InternalReadAction.kt:78)
    at com.intellij.openapi.application.rw.InternalReadAction.readLoop(InternalReadAction.kt:65)
    at com.intellij.openapi.application.rw.InternalReadAction.access$readLoop(InternalReadAction.kt:16)
    at com.intellij.openapi.application.rw.InternalReadAction$readLoop$1.invokeSuspend(InternalReadAction.kt)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

You’ve probably seen the flurry of exception reports (I assume those make it to you).

It doesn’t seem to impact functionality for me (i.e., I can still work with Rama in IntelliJ).

For reference, I’m using IntelliJ #IU-233.13135.103, Cursive 1.13.1-2023.3, and these deps:

{com.rpl/rama         {:mvn/version "0.11.4"}
 com.rpl/rama-helpers {:mvn/version "0.9.3"}
 com.rpl/rama-kafka   {:mvn/version "0.9.0"}
 org.clojure/clojure  {:mvn/version "1.11.1"}}
jdhollis commented 2 months ago

Haven’t noticed this issue since the 2024.1 upgrade.

Not sure whether it was resolved before that, but going to close for now.