vscode-java
vscode-java copied to clipboard
kotlin imports into Java file are unresolved
In a project, there are some interfaces set up in Kotlin, also config files, that are imported into the main Java file. These aren't recognized as valid imports, support for this would be useful. Attempting to move out of IntelliJ to VS Code, this is the only problem with the project.
While I can appreciate the problem, Kotlin support is kinda out of scope of our Java support at the moment. We'll need to assess if/how we can help improve the situation. It might come from a companion extension eventually.
Currently developing a language server and an extension for Kotlin, I have thought about this.
In a mixed Kotlin-Java Gradle project both languages do recognize dependencies properly. They fail when trying to use classes from the other language though.
An approach to this problem might be to add compiled JVM classes located in the other languages build directory to the classpath.
Any updates on this?
@fwcd do you have any suggestions on how to implement this either here or in the kotlin language server? you mentioned copying the classfiles around but I'm not sure how to do that manually, let alone code it up.
@coffeepac Implementing that in KotlinLanguageServer first might be easier, because the KLS repo has a smaller codebase and is pretty easy to setup.
Copying any classfiles might not even be necessary, the language server would just have to know where they are located. The Java language server uses the Eclipse project model whilst the Kotlin language server entirely relies on Gradle/Maven, thus placing the classfiles in different locations each.
When scanning the classpath from the Kotlin language server, it would have to search through the directory that the Java language server/the Eclipse project model places the compiled files in.
Can't wait for using kotlin in VSCode. When can we use kotlin in VSCode?
Any updates or news?
This also seems like the last piece for me as well to make VS Code viable for development. I am unable to run Java Junit classes that reference a Kotlin class as it is not able to find the class.
Yes this is pretty hard since most projects nowadays mix kotlin packages in the import...
Hey, just in case anyone might have missed it, I built a prototype companion extension that attempts to solve this issue: https://github.com/fwcd/vscode-java-kotlin We haven't released it yet, but if you really need this you can build it yourself for now.
Any updates on this issue?
Any updates on this?
I follow the others here: are there any updates? I'm having the same problem and it's frustrating over and over again. The program compiles correctly but since the import of Kotlin classes into Java is not supported any reference to a Kotlin class causes many error messages in the error panel, making it very difficult to work. Please can someone consider trying to fix this? Unfortunately I don't have too much knowledge to help more.
Any updates? It's frustrating to have to use IntelliJ for some projects.
Hey everyone. I finally published the companion extension I linked above to make this work: https://marketplace.visualstudio.com/items?itemName=daplf.vscode-java-kotlin
Keep in mind that this is only a prototype for now and I haven't used it with very large projects, but it seems to work well for small ones at least. If you have any problems with the extension, please create an issue. I'm happy to improve it :)
Any updates here? Will this feature come at some point?
info update
this is necessary, as we mix kotlin and java