fwcd / kotlin-language-server

Kotlin code completion, diagnostics and more for any editor/IDE using the Language Server Protocol
MIT License
1.68k stars 212 forks source link

VS code showing warning of kotlin-language-server #595

Open nizam-betterapp opened 2 months ago

nizam-betterapp commented 2 months ago

I was trying to build the kotlin server to get started on contributing the project.

Running installedDist worked fine

Screenshot 2024-09-15 at 8 50 32 PM

But warning in the IDE after the indexing is done

Screenshot 2024-09-15 at 8 57 52 PM

Attached logs for your reference kls.ownserver.log

When I run build, it's failed

Screenshot 2024-09-15 at 8 51 55 PM

Please let me know what I am doing wrong. Are those warnings with red underlines expected?

nizam-betterapp commented 2 months ago

I add this below code that writes all the dependencies into the classpath.sh and tried it. Initially I was getting the 'Classpath has not changed. Fetching from cache' log line. after i manually added another dependency, this got fixed.

`tasks.register("writeDepsToFile") { doLast { val home = System.getProperty("user.home") val outputFile = file("$home/.config/kotlin-language-server/classpath.sh") outputFile.parentFile.mkdirs() // Ensure the directory exists

    val classpath = configurations.compileClasspath.get()
        .joinToString(":") { it.absolutePath }

    outputFile.writeText("#!/bin/bash\necho $classpath\n")

    // Make the file executable
    outputFile.setExecutable(true)
}

}`

I am wondering whether this should be part of https://github.com/fwcd/kotlin-language-server/blob/main/shared/src/main/kotlin/org/javacs/kt/classpath/DefaultClassPathResolver.kt If I am going in the right direction, please let me know. will send a PR request.

Screenshot 2024-09-15 at 10 17 47 PM