kcl-lang / intellij-kcl

IntelliJ IDEA KCL Extension
https://kcl-lang.io
11 stars 11 forks source link

When I hover over element in the KCL file I am seeing plugin exception - IntelliJ #51

Open pisarenko91 opened 1 day ago

pisarenko91 commented 1 day ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Just hover over any element in .k file plugin exception pops up.

2. What did you expect to see? (Required)

I have expected to see some description of the element, types, or expected input. Depending above what I am hovering...

3. What did you see instead (Required)

I see the standard JetBrains pop up, that we encountered a plugin exception. When I check details, below is the stack trace I am getting:

java.lang.NullPointerException: Cannot invoke "com.intellij.psi.PsiDirectory.findSubdirectory(String)" because "current" is null at io.kusionstack.kcl.KCLUtil.getMatchedModule(KCLUtil.java:118) at io.kusionstack.kcl.KCLUtil.resolvePkg(KCLUtil.java:80) at io.kusionstack.kcl.KCLUtil.resolvePkg(KCLUtil.java:63) at io.kusionstack.kcl.symbol_table.DefSymbolTableVisitor.visitImportStmt(DefSymbolTableVisitor.java:38) at io.kusionstack.kcl.psi.impl.KCLImportStmtImpl.accept(KCLImportStmtImpl.java:21) at io.kusionstack.kcl.psi.impl.KCLImportStmtImpl.accept(KCLImportStmtImpl.java:26) at io.kusionstack.kcl.symbol_table.DefSymbolTableVisitor.visitElement(DefSymbolTableVisitor.java:132) at io.kusionstack.kcl.psi.KCLVisitor.visitSimpleStmt(KCLVisitor.java:303) at io.kusionstack.kcl.psi.impl.KCLSimpleStmtImpl.accept(KCLSimpleStmtImpl.java:21) at io.kusionstack.kcl.psi.impl.KCLSimpleStmtImpl.accept(KCLSimpleStmtImpl.java:26) at io.kusionstack.kcl.symbol_table.DefSymbolTableVisitor.visitElement(DefSymbolTableVisitor.java:132) at io.kusionstack.kcl.psi.KCLVisitor.visitStatement(KCLVisitor.java:319) at io.kusionstack.kcl.psi.impl.KCLStatementImpl.accept(KCLStatementImpl.java:21) at io.kusionstack.kcl.psi.impl.KCLStatementImpl.accept(KCLStatementImpl.java:26) at io.kusionstack.kcl.symbol_table.DefSymbolTableVisitor.visitElement(DefSymbolTableVisitor.java:132) at io.kusionstack.kcl.symbol_table.DefSymbolTableVisitor.startVisit(DefSymbolTableVisitor.java:28) at io.kusionstack.kcl.KCLUtil.buildSymbolTable(KCLUtil.java:39) at io.kusionstack.kcl.psi.KCLNameReference.multiResolve(KCLNameReference.java:47) at io.kusionstack.kcl.psi.KCLNameReference.resolve(KCLNameReference.java:53) at com.intellij.codeInsight.TargetElementUtilBase.getReferencedElement(TargetElementUtilBase.java:173) at com.intellij.codeInsight.TargetElementUtilBase.doGetReferenceOrReferencedElement(TargetElementUtilBase.java:161) at com.intellij.codeInsight.TargetElementUtilBase.getReferenceOrReferencedElement(TargetElementUtilBase.java:203) at com.intellij.codeInsight.TargetElementUtilBase.getReferencedElement(TargetElementUtilBase.java:245) at com.intellij.codeInsight.TargetElementUtilBase.doFindTargetElement(TargetElementUtilBase.java:225) at com.intellij.codeInsight.TargetElementUtilBase.findTargetElement(TargetElementUtilBase.java:287) at com.intellij.codeInsight.TargetElementUtil.findTargetElement(TargetElementUtil.java:144) at com.intellij.model.psi.impl.TargetsKt.fromTargetEvaluator(targets.kt:175) at com.intellij.model.psi.impl.TargetsKt.declarationsOrReferences(targets.kt:136) at com.intellij.model.psi.impl.TargetsKt.declaredReferencedData(targets.kt:42) at com.intellij.model.psi.impl.TargetsKt.targetSymbols(targets.kt:24) at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.getTargetSymbols(IdentifierHighlighterPass.java:235) at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.highlightReferencesAndDeclarations(IdentifierHighlighterPass.java:226) at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.lambda$doCollectInformation$0(IdentifierHighlighterPass.java:108) at com.intellij.openapi.project.DumbService.withAlternativeResolveEnabled(DumbService.kt:339) at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.doCollectInformation(IdentifierHighlighterPass.java:107) at com.intellij.codeInsight.highlighting.BackgroundHighlighterKt.submitIdentifierHighlighterPass$lambda$17$lambda$16$lambda$14(BackgroundHighlighter.kt:409) at com.intellij.codeInsight.highlighting.BackgroundHighlighterKt.submitIdentifierHighlighterPass$lambda$17$lambda$16$lambda$15(BackgroundHighlighter.kt:409) at com.intellij.codeInsight.daemon.impl.HighlightingSessionImpl.runInsideHighlightingSession(HighlightingSessionImpl.java:182) at com.intellij.codeInsight.highlighting.BackgroundHighlighterKt.submitIdentifierHighlighterPass$lambda$17$lambda$16(BackgroundHighlighter.kt:406) at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:157) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:140) at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:223) at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:45) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:222) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$14(CoreProgressManager.java:674) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:749) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:705) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:673) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:203) at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:137) at com.intellij.codeInsight.highlighting.BackgroundHighlighterKt.submitIdentifierHighlighterPass$lambda$17(BackgroundHighlighter.kt:402) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor.callWrapped(NonBlockingReadActionImpl.java:857) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor$MonitoredComputation.call(NonBlockingReadActionImpl.java:889) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:618) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$4(NonBlockingReadActionImpl.java:581) at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:351) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:971) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:95) at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:157) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:140) at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:223) at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:45) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:222) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$14(CoreProgressManager.java:674) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:749) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:705) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:673) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:203) at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:137) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:95) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:581) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:480) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$2(NonBlockingReadActionImpl.java:495) at com.intellij.codeInsight.highlighting.BackgroundHighlighterKt$registerListeners$executor$1$1.invokeSuspend(BackgroundHighlighter.kt:118) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:608) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:873) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:763) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:750)

4. What is your KCL components version? (Required)

kcl version 0.10.10

IntelliJ:

IntelliJ IDEA 2024.3 (Ultimate Edition) Build #IU-243.21565.193, built on November 13, 2024

Runtime version: 21.0.5+8-b631.16 aarch64 (JCEF 122.1.9) VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 15.1.1 Kotlin: 243.21565.193-IJ

Peefy commented 1 day ago

cc @He1pa