-
Notifications
You must be signed in to change notification settings - Fork 231
Java extension support #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@fwcd any suggestions on where to start for a PR for this? in its current state, how does the language server locate compiled files? |
@mrjones2014 Sure. Currently, the language server uses Maven or Gradle to find a set of JAR paths: Although
To allow Kotlin to see Java classes, we need to add the Allowing Java to see Kotlin classes is probably trickier because we would need to modify the |
@fwcd could this help? |
@mrjones2014 Although this project looks interesting, the main issue with |
@fwcd hm yeah, good point. I'm really busy at work at the moment but eventually I'm gonna try to get around to making that PR. |
@fwcd, any news on this? What can I do manually in the meanwhile to make Java see Kotlin? Thanks, |
@khe817 Using Java classes from Kotlin will hopefully be possible soon (I've successfully experimented with this over at the kotlin-debug-adapter). The other way around is a bit trickier, unfortunately, since it requires integration with the Java side and its project model (Eclipse |
@fwcd so, is there any way to import Java <—> Kotlin classes for now?
How to do this? Or is it a hypothetical option? |
@petersamokhin Importing Java <-> Kotlin either way around is not possible yet, unfortunately. |
@fwcd you told:
Maybe this is possible to do? |
@fwcd now I only need to import generated |
I believe resolving java symbols within Kotlin files is more prominent case. |
@fwcd what is needed here to implement this feature? Currently, I'm the Kotlin language server is unable to import classes from java dependencies defined inside of I'll be more than happy to open a PR to implement this crucial feature. |
Hey @fwcd, Any update on this, let me know the detail for this feature. Happy to help on it. |
As proposed by the developer, the solution would only allow Java extension to see Kotlin symbols from the bytecode, so completions might be available, but jump to source can be tricky, and Java extension will not know anything about the Kotlin source. Letting Kotlin resolve Java is easy, because the Kotlin compiler understands Java. But it can also happen that the Kotlin compiler has different understanding of Java files than the Java extension, because they're implemented separately. This is a general problem of the VSCode LSP design and fixing this requires rewriting the entire protocol (to make the client aware of AST and referential structures). |
It would also be impossible for Kotlin to interop with Scala, because Kotlin compiler doesn't understand Scala, neither do Scala compiler understands Kotlin. But in IntelliJ it all works (using the builtin build system), because IntelliJ understands referential structure and handles compilation in the correct way. |
https://github.com/fwcd/vscode-java-kotlin looks legit for this particular situation (which is surprising to me) but it's apparently a burden for the future (it needs to be kept sync with kotlin/java extensions). (I'm not trying to make a point here, just leaving some notes. This project is very cool and it's a shame that VSCode's design has limited it in this unpleasant way) |
Hey everyone. For any vscode users interested, I just published This should allow Java code to see Kotlin code. If you're using a different editor, the extension may still help, but you'll need to do most of the wiring yourself. Take a look at the code if interested: https://github.com/daplf/vscode-java-kotlin |
vscode-java now use a custom Gradle build server that respect Gradle build directory by default, any updates on this? |
Uh oh!
There was an error while loading. Please reload this page.
Support vscode-java, so Java can see Kotlin classes and vice versa.
The text was updated successfully, but these errors were encountered: