FalsePattern / ZigBrains

The zig language plugin for intellij
https://falsepattern.com/zigbrains
Other
121 stars 9 forks source link

LPS not loading because of 'NullPointerException: getSourceRoots' #62

Closed MrLittleTexas closed 2 months ago

MrLittleTexas commented 2 months ago

Initially on install worked fine. Now IntelliJ launches with the following error and the LSP is not loading:

java.lang.NullPointerException: getSourceRoots(...) must not be null
    at com.intellij.workspaceModel.core.fileIndex.impl.NonIncrementalContributors.computeFileSets(NonIncrementalContributors.kt:160)
    at com.intellij.workspaceModel.core.fileIndex.impl.NonIncrementalContributors.updateIfNeeded(NonIncrementalContributors.kt:50)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.ensureIsUpToDate(WorkspaceFileIndexDataImpl.kt:154)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.getFileInfo(WorkspaceFileIndexDataImpl.kt:94)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getFileInfo(WorkspaceFileIndexImpl.kt:260)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.isUnderIgnored(ProjectFileIndexImpl.java:78)
    at com.intellij.openapi.roots.impl.ProjectFileIndexFacade.isUnderIgnored(ProjectFileIndexFacade.java:73)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.isExcludedOrIgnored(FileManagerImpl.java:441)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.findDirectoryImpl(FileManagerImpl.java:427)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.findDirectory(FileManagerImpl.java:420)
    at com.intellij.psi.impl.PsiManagerImpl.findDirectory(PsiManagerImpl.java:175)
    at com.intellij.psi.AbstractFileViewProvider.shouldCreatePsi(AbstractFileViewProvider.java:89)
    at com.intellij.psi.SingleRootFileViewProvider.createFile(SingleRootFileViewProvider.java:146)
    at com.intellij.psi.SingleRootFileViewProvider.getPsiInner(SingleRootFileViewProvider.java:102)
    at com.intellij.psi.AbstractFileViewProvider.getPsi(AbstractFileViewProvider.java:185)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.findFile(FileManagerImpl.java:382)
    at com.intellij.psi.impl.PsiDocumentManagerBase.getPsiFile(PsiDocumentManagerBase.java:150)
    at com.intellij.psi.impl.PsiDocumentManagerBase.getPsiFile(PsiDocumentManagerBase.java:99)
    at com.intellij.psi.impl.PsiDocumentManagerImpl.getPsiFile(PsiDocumentManagerImpl.java:62)
    at com.intellij.codeInsight.folding.impl.CodeFoldingManagerImpl.buildInitialFoldings(CodeFoldingManagerImpl.java:144)
    at com.intellij.openapi.fileEditor.impl.text.FoldingTextEditorInitializer$initializeEditor$foldingState$1$1$1.invoke(FoldingTextEditorInitializer.kt:35)
    at com.intellij.openapi.fileEditor.impl.text.FoldingTextEditorInitializer$initializeEditor$foldingState$1$1$1.invoke(FoldingTextEditorInitializer.kt:34)
    at com.intellij.openapi.progress.CoroutinesKt.jobToIndicator$lambda$2(coroutines.kt:445)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:217)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98)
    at com.intellij.openapi.progress.CoroutinesKt.jobToIndicator(coroutines.kt:433)
    at com.intellij.openapi.progress.CoroutinesKt.contextToIndicator(coroutines.kt:425)
    at com.intellij.openapi.progress.CoroutinesKt.blockingContextToIndicator(coroutines.kt:401)
    at com.intellij.openapi.fileEditor.impl.text.FoldingTextEditorInitializer$initializeEditor$foldingState$1$1.invoke(FoldingTextEditorInitializer.kt:34)
    at com.intellij.openapi.fileEditor.impl.text.FoldingTextEditorInitializer$initializeEditor$foldingState$1$1.invoke(FoldingTextEditorInitializer.kt:33)
    at com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImplKt.catchingExceptions(PsiAwareTextEditorImpl.kt:117)
    at com.intellij.openapi.fileEditor.impl.text.FoldingTextEditorInitializer$initializeEditor$foldingState$1.invoke(FoldingTextEditorInitializer.kt:33)
    at com.intellij.openapi.fileEditor.impl.text.FoldingTextEditorInitializer$initializeEditor$foldingState$1.invoke(FoldingTextEditorInitializer.kt:31)
    at com.intellij.openapi.application.rw.InternalReadAction.insideReadAction(InternalReadAction.kt:104)
    at com.intellij.openapi.application.rw.InternalReadAction.access$insideReadAction(InternalReadAction.kt:15)
    at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:94)
    at com.intellij.openapi.application.rw.InternalReadAction$tryReadCancellable$2.invoke(InternalReadAction.kt:93)
    at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$2$lambda$1$lambda$0(cancellableReadAction.kt:31)
    at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.tryRunReadAction(AnyThreadWriteThreadingSupport.kt:291)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:965)
    at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$2$lambda$1(cancellableReadAction.kt:29)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:155)
    at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal(cancellableReadAction.kt:27)
    at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable(InternalReadAction.kt:93)
    at com.intellij.openapi.application.rw.InternalReadAction.tryReadAction(InternalReadAction.kt:77)
    at com.intellij.openapi.application.rw.InternalReadAction.readLoop(InternalReadAction.kt:64)
    at com.intellij.openapi.application.rw.InternalReadAction.access$readLoop(InternalReadAction.kt:15)
    at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$4.invokeSuspend(InternalReadAction.kt:43)
    at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$4.invoke(InternalReadAction.kt)
    at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$4.invoke(InternalReadAction.kt)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:62)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:163)
    at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
    at com.intellij.openapi.application.rw.InternalReadAction.runReadAction(InternalReadAction.kt:39)
    at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAction(PlatformReadWriteActionSupport.kt:38)
    at com.intellij.openapi.application.ReadWriteActionSupport.executeReadAction$default(ReadWriteActionSupport.kt:15)
    at com.intellij.openapi.application.CoroutinesKt.constrainedReadAction(coroutines.kt:58)
    at com.intellij.openapi.application.CoroutinesKt.readAction(coroutines.kt:25)
    at com.intellij.openapi.fileEditor.impl.text.FoldingTextEditorInitializer.initializeEditor(FoldingTextEditorInitializer.kt:31)
    at com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider$createInitTask$1$1$1.invokeSuspend(PsiAwareTextEditorProvider.kt:138)
    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)
Andres6936 commented 2 months ago

Same error in:

WebStorm 2024.2
Build #WS-242.20224.342, built on August 8, 2024
...
Runtime version: 21.0.3+13-b509.4 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 1652M
Cores: 12
Registry:
  ide.experimental.ui=true
  ide.images.show.chessboard=true
Non-Bundled Plugins:
  com.vermouthx.xcode-theme (1.7.0)
  com.jetbrains.space (242.20224.155)
  com.redhat.devtools.lsp4ij (0.4.0)
  com.falsepattern.zigbrains (17.1.0-242)
  com.github.catppuccin.jetbrains (3.3.1)
  com.intellij.ml.llm (242.20224.424)
  org.intellij.prisma (242.20224.159)
  com.intellij.database (242.20224.426)
  org.jetbrains.plugins.astro (242.20224.155)
Andres6936 commented 2 months ago

Solution, use absolute path and overrride the path to lib/std: https://github.com/FalsePattern/ZigBrains/issues/60#issuecomment-2290196252

image
MrLittleTexas commented 2 months ago

Thanks, I had missed this since the changelog said this was fixed in the recent version, but I guess it is not

FalsePattern commented 2 months ago

Should be properly fixed in 17.2.0 hopefully.