Skip to content

Using nvim client, WorkspaceFileIndex is not initialized yet #31

Open
@pepegar

Description

@pepegar

Version v0.252.17811

I'm getting this when trying to use kotlin-lsp on vim on my project:

Error log [START][2025-05-28 10:46:29] LSP logging initiated [ERROR][2025-05-28 10:46:29] .../vim/lsp/rpc.lua:770 "rpc" "/Users/pepe/bin/kotlin-ls" "stderr" "WARNING: package sun.awt.windows not in java.desktop\n" [ERROR][2025-05-28 10:46:29] .../vim/lsp/rpc.lua:770 "rpc" "/Users/pepe/bin/kotlin-ls" "stderr" "WARNING: package sun.awt.X11 not in java.desktop\nWARNING: package com.sun.java.swing.plaf.gtk not in java.desktop\n" [ERROR][2025-05-28 10:46:30] ...lsp/handlers.lua:623 "[SEVERE] #com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl: WorkspaceFileIndex is not initialized yet, empty data is returned. Activities which use the project configuration must be postponed until the project is fully loaded.It is possible to check Project.isInitialized to verify that the project is fully loaded.\nWorkspaceFileIndex is not initialized yet, empty data is returned. Activities which use the project configuration must be postponed until the project is fully loaded.It is possible to check Project.isInitialized to verify that the project is fully loaded.\njava.lang.Throwable: WorkspaceFileIndex is not initialized yet, empty data is returned. Activities which use the project configuration must be postponed until the project is fully loaded.It is possible to check Project.isInitialized to verify that the project is fully loaded.\n\tat com.intellij.openapi.diagnostic.Logger.error(Logger.java:375)\n\tat com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getMainIndexData(WorkspaceFileIndexImpl.kt:396)\n\tat com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getFileInfo(WorkspaceFileIndexImpl.kt:344)\n\tat org.jetbrains.kotlin.idea.base.fir.projectStructure.provider.CandidateCollector.collectCandidatesByVirtualFile(CandidateCollector.kt:67)\n\tat org.jetbrains.kotlin.idea.base.fir.projectStructure.provider.K2IDEProjectStructureProvider.getAssociatedKaModules(K2IDEProjectStructureProvider.kt:232)\n\tat org.jetbrains.kotlin.idea.base.projectStructure.ApiKt.getAssociatedKaModules(api.kt:227)\n\tat com.jetbrains.ls.snapshot.api.impl.core.kotlin.LLFirSessionCacheStorageEntity$Companion$getInvalidationEvent$2.invokeSuspend(llFirKotlinCaches.kt:82)\n\tat com.jetbrains.ls.snapshot.api.impl.core.kotlin.LLFirSessionCacheStorageEntity$Companion$getInvalidationEvent$2.invoke(llFirKotlinCaches.kt)\n\tat com.jetbrains.ls.snapshot.api.impl.core.kotlin.LLFirSessionCacheStorageEntity$Companion$getInvalidationEvent$2.invoke(llFirKotlinCaches.kt)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImpl$withAnalysisContextImpl$2.invokeSuspend(LSServerAnalyzerImpl.kt:180)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImpl$withAnalysisContextImpl$2.invoke(LSServerAnalyzerImpl.kt)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImpl$withAnalysisContextImpl$2.invoke(LSServerAnalyzerImpl.kt)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImplKt$withCurrentProject$2$1$1$use$2$1.invokeSuspend(LSServerAnalyzerImpl.kt:62)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImplKt$withCurrentProject$2$1$1$use$2$1.invoke(LSServerAnalyzerImpl.kt)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImplKt$withCurrentProject$2$1$1$use$2$1.invoke(LSServerAnalyzerImpl.kt)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerProject$2$1$2.invokeSuspend(AnalyzerImpl.kt:484)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerProject$2$1$2.invoke(AnalyzerImpl.kt)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerProject$2$1$2.invoke(AnalyzerImpl.kt)\n\tat kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:44)\n\tat kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:285)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerProject$2$1.invokeSuspend(AnalyzerImpl.kt:483)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerProject$2$1.invoke(AnalyzerImpl.kt)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerProject$2$1.invoke(AnalyzerImpl.kt)\n\tat kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:44)\n\tat kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:166)\n\tat kotlinx.coroutines.BuildersKt.withContext(Unknown Source)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerProject$2.invokeSuspend(AnalyzerImpl.kt:414)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerProject$2.invoke(AnalyzerImpl.kt)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerProject$2.invoke(AnalyzerImpl.kt)\n\tat fleet.util.async.JobExtKt$withCoroutineScope$2.invokeSuspend(JobExt.kt:47)\n\tat fleet.util.async.JobExtKt$withCoroutineScope$2.invoke(JobExt.kt)\n\tat fleet.util.async.JobExtKt$withCoroutineScope$2.invoke(JobExt.kt)\n\tat kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:44)\n\tat kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:285)\n\tat fleet.util.async.JobExtKt.withCoroutineScope(JobExt.kt:47)\n\tat fleet.util.async.JobExtKt.withCoroutineScope$default(JobExt.kt:40)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt.withAnalyzerProject(AnalyzerImpl.kt:371)\n\tat com.jetbrains.analyzer.bootstrap.AnalyzerImplKt$withAnalyzerImpl$2$analyzerImpl$1.withProject(AnalyzerImpl.kt:225)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImplKt$withCurrentProject$2$1$1$use$2.invokeSuspend(LSServerAnalyzerImpl.kt:49)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImplKt$withCurrentProject$2$1$1$use$2.invoke(LSServerAnalyzerImpl.kt)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImplKt$withCurrentProject$2$1$1$use$2.invoke(LSServerAnalyzerImpl.kt)\n\tat kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:44)\n\tat kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:166)\n\tat kotlinx.coroutines.BuildersKt.withContext(Unknown Source)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImplKt$withCurrentProject$2$1$1.use(LSServerAnalyzerImpl.kt:42)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImpl.withAnalysisContextImpl(LSServerAnalyzerImpl.kt:175)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSServerAnalyzerImpl.withAnalysisContext-8DJE7mQ(LSServerAnalyzerImpl.kt:163)\n\tat com.jetbrains.ls.snapshot.api.impl.core.kotlin.LLFirSessionCacheStorageEntity$Companion.getInvalidationEvent(llFirKotlinCaches.kt:80)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSDocumentsImpl.performInvalidationWithLLFirCaches$language_server_api_impl_analyzer(LSDocumentsImpl.kt:171)\n\tat com.jetbrains.ls.snapshot.api.impl.core.LSDocumentsImpl.didOpen-q8nZ1UI(LSDocumentsImpl.kt:122)\n\tat com.jetbrains.ls.kotlinLsp.requests.core.FileUpdatesKt$fileUpdateRequests$1.invokeSuspend(fileUpdates.kt:10)\n\tat com.jetbrains.ls.kotlinLsp.requests.core.FileUpdatesKt$fileUpdateRequests$1.invoke(fileUpdates.kt)\n\tat com.jetbrains.ls.kotlinLsp.requests.core.FileUpdatesKt$fileUpdateRequests$1.invoke(fileUpdates.kt)\n\tat com.jetbrains.lsp.implementation.WithLspKt$withLsp$3$1$1.invokeSuspend(withLsp.kt:246)\n\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)\n\tat kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)\n\tat kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:613)\n\tat kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:1189)\n\tat kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:778)\n\tat kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:765)\n"

Notice that on VSCode it works correctly.

Here is my nvim config:

    if not configs.kotlin_ls then
      configs.kotlin_ls = {
        default_config = {
          cmd = { 'kotlin-ls', '--stdio' },
          single_file_support = true,
          filetypes = { 'kotlin' },
          root_markers = { 'build.gradle', 'build.gradle.kts', 'pom.xml' },
        },
      }
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions