-
Notifications
You must be signed in to change notification settings - Fork 337
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
Java support status placeholder #3398
Comments
So, more of just a question, but in the TODO section, how many of these things do we actually want? Is the goal truly to cover them all? It's incredible that we now support java targets, but I'm also wondering at what point does Metals, the Scala language server venture too far into the Java land support? Realistically we'll never reach parity with something like IntelliJ for cross-JVM languages, but I also don't really think that's a goal. Adding all the features on this list is no small task, and also increases the scope of Metals. Is that what we want? I guess I just never assumed that something like formatting on type for Java sources is something that Metals would support or want to support. Again, I don't mean this to take away from the fantastic achievement of the Java support we now have. #2520 is truly fantastic work! I'd just love to get a clearer idea of what the ultimate goal is with our Scala Java interop and Java support. |
I'm pretty happy with the current set of functionality. It makes working with combined Scala/Java codebases so much easier. I think run/debug As for the others, I thought I'd fix whatever problems came up after release and then wait to see if anyone has a real need for anything else. I doubt I'll be looking to add any of it anytime soon. (I don't actually need or want format-on-type) In terms of increasing the scope of Metals - I shift between thinking that a larger scope and hence larger user base is a good thing for supplying ideas for helpful features and for finding bugs but possibly a bad thing considering a lot of Java requirements probably won't overlap very much with Scala. And of course, all this java stuff has to be supported by scala devs 😢 |
😆 of course, a larger user base is always great, but I think it's important to talk about where we'd like to end up in terms of interop. I'm maybe an outlier in that if I talk with people that work in heavy Java / Scala projects, I recommend IntelliJ with zero hesitation. We also have a decent size user base that uses Metals because it's lighter, faster, and more agile due to its limited scope. I'd hate to lose that.
Indeed. |
A lot of the features that depend on semanticdb should be simple to add and should use exactly the same logic. The hardest part would be things requiring PC, which I don't believe is in our reach. I would also not support any refactorings and focus on the Scala ones. Of course if anyone is willing to contribute anything I would gladly accept those, but I don't think the should ever be in our main scope. One thing that would be awesome is if we were able to start java language server in the background and make Metals as a intermediary, which means a lot of things could come for free. But this is a whole other rabbit hole, or rather a dragon's cave of difficulties. |
Btw. I think we could do hover using semanticdb, which would be low effort, but could help out people investigating their codebases. |
I took a look at fixing renames and there seems to be an issue with file watcher for java semanticdb files and also semanticdb for Java files starts at 0 instead of 1 like in Scala. My attempt is here: https://github.com/scalameta/metals/compare/main...tgodzik:fix-java-renames?expand=1 Another issue we noticed is that we should not show java in the doctor for Scala only files (or figure out a smarter way of doing it all) |
For the Doctor - I guess we could check if there are no java files in the project - then not show the java info. I'm not sure there's anything from the BSP to indicate this as it's valid to have empty javacoptions. Not sure it's possible to even specify in the build tools that the project is only Scala. With Gradle you can't have a project that supports only Scala (java support is implicit). Not sure if that's the same as SBT, Mill, Bazel. I guess they all use Zinc under the hood so it'll quite happily compile a java file? |
One thing I keep seeing for example when in the Java files in Metals is this in the logs:
I don't fully get where the |
I think
I've never seen the |
Ahhh sorry for the noise!! I never noticed it before 😬 and happened to when paying more attention to the logs now when trying every out. |
No worries - I fully expect some issue(s) as it's a big PR and I've only run it on Windows+WSL which I doubt is that common. Plus I may have been a bit lax on writing tests 😟 |
After chatting with @Arthurm1 on Discord about this a bit, here's what I'd propose. What if instead of showing an entire new target for this we just do something like this:
And java support is calculated based on |
Additional issue. If you open a scala-cli project as it was described in #3414 Metals warns about But this one incorrect as there is no java sources in project. |
One thing I just hit on in a project which isn't a huge issue, but still should probably be addressed, I have a
I guess I wouldn't expect this to be offered as a completion item. How come this is, and is there a way we can ensure this isn't offered unless a user is explicitly using this? |
That's because the java plugin ends up on the classpath :/ We could exclude it from completions, but this means if anyone wants to use it the would need to modify the exclude paths 🤔 |
🤔 hmm excluding isn't ideal either, that could probably cause a lot of confusion for someone wanting to actually use that dep and then they get no completions unless it's removed. I'm not sure then. |
Could we ask Sourcegraph to release an additional jar that's entirely shaded? And Metals/Bloop could use that one? |
I think it might be solved on bloop side. I don't see sourcegraph jars in bloop json files so it seems that the returned only over bsp request |
The jar gets added to the classpath dynamically here based on the contents of the |
I wanted to test java support in Metals. I opened a Gradle project with only java sources and Metals won't start since there is no |
I can't imagine the case when somebody wants to use Metals on a full-java project. |
Agreed, imo this isn't an area we want to venture in. |
I did a quick PoC of showing hover using semanticdb here, but I am not 100% sure if we want to go this way. What we would need to do still:
Main drawback of this would be that it would be much less efficient and non-interactive. We should probably move everything that we don't plan to fix currently into separate feature requests and discuss the topics there. |
@kpodsiad I think it would be nice to have a command to start Metals. I find it strange that you can navigate to the Metals tab on VSCode and can't use Metals until opening a Scala file. It would be nice to have a "Start Metals Anyway" button underneath the "New Scala Project" button. |
Closing this one, I mentioned what still needs to be done in scalameta/metals-feature-requests#5 |
Supported features...
super
code lensesTodo...
RefactoringRename (@tgodzik I don't think we want to support more advanced refactorings than renames)The text was updated successfully, but these errors were encountered: