-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Embed Scala source code parameters into .class files meta-data (for better handling of Scala libraries in IDEs) #21894
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
The same is actual for Scala 2, so I invite to @som-snytt, @lryt, @SethTisue to this discussion |
Also ping @adpi2, who I believe did something in this space for Metals. |
Thanks @unkarjedy for starting this discussion. This issue also affects the debugger's expression evaluator (and potentially other parts of Metals, though I’m not certain). However, I don't think that storing these compiler inputs in the class file or TASTy file is ideal, because:
Instead, I believe this metadata should be included in the POM file by the build tool that generates it, along with the dependencies. |
Has there been any prior discussion along these lines...? |
I mentioned that idea during the tooling summit in Madrid, but I don't remember if there is an online discussion about it. |
Ah, I think that's what I'm remembering, yeah. |
@unkarjedy What are examples of the worst thing or things that currently happen to users, for the lack of this? I can see that in theory:
could be a source of issues, but I'm curious what the actual user pain currently looks like |
Hello. I have several points to comment on, but unfortunately, I am quite busy these weeks. |
We discussed it today and decided that it would be best to put it into pom.xml and that should be the responsibility of a build tool. We need to check how hard would it be to add. |
I think that Scala CLI uses coursier/publish to create POM files and to publish them. In sbt we still use Ivy (a fork of it) but we would like to move away from it, and we are considering coursier/publish instead (see discussion). So if it is implemented there, it would be a good incentive to make the move. Maybe Mill could use coursier/publish as well, if it is not the case already. |
Sorry, I completely lost sight of this ticket. I still believe that the compiler should store some limited amount of information directly in the Class / Tasty files.
AFAIU there is plenty of existing duplication: versions, imports (!), source file, source file paths, etc… (I haven’t rechecked everything).
AFAIU The information about the plugin can be extracted from the plugin jar META-INF.
I don’t think I fully got it.
|
Right now I am not aware of external users issues caused by this.
But I suffer form this issue myself and that's how I remembered about this now. Basic things might just not work, and without digging deep one wouldn't understand that it's caused by this. ![]() ![]() ![]() UPD ![]() ![]() ![]() |
I understand the issue and I think we do need to fix it, but adding things to pom.xml or to manifest would really be the way to go.
Sure, but for a really large codebase that becomes to actually be a problem. And if we really don't have to add the info to each classfile we should not do that.
And if this information is not present? I don't think we can also extract the repository this is present in without the build tool. So this would be really limited mechanism.
It's actually less complicated since they already create those pom.xml and manifests. This logic is already there, we just need a bit more info. But still I think the biggest issue and it will likely be vetoed is to make every classfile larger without clear benefits to do this over using build tool mechanisms. And as you said it yourself, this hasn't even been reported by any user. For you case the solution would be to always add |
AFAIU there are some contracts saying that it should be there and build tools already add it there.
Why is the repository needed at all?
JFTR Given the use case it might be indeed a bit much.
This hack can shoot back as in Scala 2 |
Yeah, sleeping over it, I think that it would make sense to add it to the build tool. |
Original issue description in IntelliJ Scala Plugin YouTrack:
https://youtrack.jetbrains.com/issue/SCL-20896/Source-code-parameters-for-Scala-libraries
Short summary:
The issue: IDEs can’t reliably interpret Scala source files in libraries due to missing project-specific compiler configurations (like compiler version, compiler options, compiler plugins used during the compilation)
The proposal: Embed essential compiler configurations in metadata (e.g., via a
@CompilerOptions
annotation) to maintain accurate source interpretation without relying on build tool modifications.Below is the copy of the original YouTrack ticket description:
The text was updated successfully, but these errors were encountered: