kotlin-language-server icon indicating copy to clipboard operation
kotlin-language-server copied to clipboard

Experimental resolution of dependencies in Kotlin multiplatform projects (Gradle)

Open themkat opened this issue 3 years ago • 1 comments

Implements basic dependency resolution for Kotlin multiplatform projects using Gradle, though a bit flawed (see below). Multiplatform projects have a bit of a different structure than what we are used to in regular projects. In one folder (and build.gradle file) there can be several targets. You can read more on that here.

Have tried a few different projects, mainly (found in #376): https://github.com/ktorio/ktor-samples/tree/main/chat

Seem to work pretty good, but I see one possible issue:

  • The language server does not separate between the different targets, so it will just resolve the dependencies for all of them. That means a frontend target will get completions with dependencies of the backend target and so on. This is because the language server works on a gradle module basis, and not on a Kotlin multiplatform target basis. This would have to be rewritten to work properly, and I think this might be a lot of work. I still think some flawed support is way better than people getting tons of errors. Now they can at least work with external dependencies in those projects (no errors, and completions work) 🙂 Feel free to disagree.

themkat avatar Aug 01 '22 16:08 themkat

Interesting, I haven't tested KLS with anything outside of Kotlin/JVM, but improving support for multiplatform definitely sounds useful! Perhaps this would even move us a bit closer to #11

fwcd avatar Aug 04 '22 03:08 fwcd