Skip to content

Add multiple source set support #36

@Esensats

Description

@Esensats

I want to use Zed with Kotlin Multiplatform. A typical kotlin multiplatform project usually has multiple source sets like this:

// build.gradle.kts (:composeApp)
kotlin {
    sourceSets {
        val desktopMain by getting

        androidMain.dependencies {
            implementation(compose.preview)
            implementation(libs.androidx.activity.compose)
        }
        commonMain.dependencies {
            implementation(compose.runtime)
            implementation(compose.foundation)
            implementation(compose.material3)
            implementation(compose.ui)
            implementation(compose.components.resources)
            implementation(compose.components.uiToolingPreview)
            implementation(libs.androidx.lifecycle.viewmodel)
            implementation(libs.androidx.lifecycle.runtimeCompose)
        }
        commonTest.dependencies {
            implementation(libs.kotlin.test)
        }
        desktopMain.dependencies {
            implementation(compose.desktop.currentOs)
            implementation(libs.kotlinx.coroutinesSwing)
        }
    }
}

Using such a setup results in LSP errors such as:

interface Platform {
    val name: String
}

expect fun getPlatform(): Platform // <- Function 'getPlatform': expect and corresponding actual are declared in the same module, which will be prohibited in Kotlin 2.0. See https://youtrack.jetbrains.com/issue/KT-55177 (kotlin EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE)

Even though the actual definitions are all in separate source sets.


Expected behavior: not showing the error if the actual implementations are correctly separated into different source sets. Potentially, providing the user with the list of actual implementations, and letting the user jumping to one of them (like in Android Studio)

To recreate just create a KMP project with their template, it already has an expect/actual platform example code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions