bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
761 stars 303 forks source link

CLion 2023.3.1 with latest bazel plugin 2023.11.23.0.1-api-version-233 throw exception. java.lang.IllegalStateException: Non-blaze project is provided #5894

Open Allsochen opened 8 months ago

Allsochen commented 8 months ago

Description of the bug:

java.lang.IllegalStateException: Non-blaze project is provided at com.google.common.base.Preconditions.checkState(Preconditions.java:502) at com.google.idea.blaze.base.sync.data.DelegatingBlazeProjectDataManager.lambda$new$0(DelegatingBlazeProjectDataManager.java:39) at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:183) at com.google.idea.blaze.base.sync.data.DelegatingBlazeProjectDataManager.getBlazeProjectData(DelegatingBlazeProjectDataManager.java:50) at com.google.idea.blaze.base.sync.SyncCache.get(SyncCache.java:57) at com.google.idea.blaze.base.sync.workspace.WorkspaceHelper.getExternalWorkspaceRoots(WorkspaceHelper.java:165) at com.google.idea.blaze.base.sync.workspace.WorkspaceHelper.resolveBlazePackage(WorkspaceHelper.java:67) at com.google.idea.blaze.base.lang.buildfile.references.BuildReferenceManager.resolveLabel(BuildReferenceManager.java:75) at com.google.idea.blaze.base.lang.buildfile.references.BuildReferenceManager.resolveLabel(BuildReferenceManager.java:69) at com.google.idea.blaze.base.lang.buildfile.references.LabelReference.resolveTarget(LabelReference.java:70) at com.google.idea.blaze.base.lang.buildfile.references.LabelReference.resolve(LabelReference.java:55) at com.google.idea.blaze.base.lang.buildfile.references.LoadedSymbolReference.resolve(LoadedSymbolReference.java:43) at com.google.idea.blaze.base.lang.buildfile.references.LoadedSymbolReference.resolve(LoadedSymbolReference.java:31) 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:147) at com.jetbrains.cidr.lang.psi.impl.OCTargetElementUtil.findTargetElement(OCTargetElementUtil.java:47) 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.webSymbols.documentation.WebSymbolDocumentationTargetProvider.documentationTargets(WebSymbolDocumentationTargetProvider.kt:15) at com.intellij.lang.documentation.impl.TargetsKt.documentationTargets(targets.kt:20) at com.intellij.lang.documentation.ide.impl.IdeDocumentationTargetProviderImpl.documentationTargets(IdeDocumentationTargetProviderImpl.kt:36) at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt$calcTargetDocumentationInfo$1$requests$1$targets$1.invoke(DocumentationTargetHoverInfo.kt:39) at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt$calcTargetDocumentationInfo$1$requests$1$targets$1.invoke(DocumentationTargetHoverInfo.kt:39) at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt.injectedThenHost(DocumentationTargetHoverInfo.kt:76) at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt$calcTargetDocumentationInfo$1$requests$1.invoke(DocumentationTargetHoverInfo.kt:37) at com.intellij.lang.documentation.ide.impl.DocumentationTargetHoverInfoKt$calcTargetDocumentationInfo$1$requests$1.invoke(DocumentationTargetHoverInfo.kt:36) 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$runReadAction$4.invokeSuspend(InternalReadAction.kt:44) 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)

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

1.Install C++ bazel plugin(2023.11.23.0.1-api-version-233) 2.Create a C++ Executable project, not a bazel project by using CLion 2023.3.1. 3.Create a WORKSPACE/BUILD file under the root path. 4.Click some files.

Which Intellij IDE are you using? Please provide the specific version.

CLion 2023.3.1

What programming languages and tools are you using? Please provide specific versions.

C++

What Bazel plugin version are you using?

2023.11.23.0.1-api-version-233

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

cdelguercio commented 8 months ago

I see the same issue still with Goland 2023.3.2 Build #GO-233.13135.104, built on December 19, 2023

tpasternak commented 8 months ago

In order to reproduce, there must a BUILD file referencing a valid symbol loaded with load(...) statement.

Apart from that, it could quite hard to fix the generic case, so to disable the whole PSI parsing.