sbt-idea-plugin icon indicating copy to clipboard operation
sbt-idea-plugin copied to clipboard

A rudimentary support for Scala 3

Open azolotko opened this issue 4 years ago • 11 comments

azolotko avatar Aug 19 '21 08:08 azolotko

related https://youtrack.jetbrains.com/issue/SCL-19086

unkarjedy avatar Aug 19 '21 08:08 unkarjedy

@unkarjedy ~might be also related to https://github.com/sbt/sbt/issues/6628~

Never mind, that issue is invalid.

azolotko avatar Aug 19 '21 15:08 azolotko

Can someone comment on the status of this PR?

@jastice I suppose we're awaiting @azolotko's reply to https://github.com/JetBrains/sbt-idea-plugin/pull/111#discussion_r992417083 ?

izzyreal avatar Aug 31 '23 12:08 izzyreal

Can someone comment on the status of this PR?

@jastice I suppose we're awaiting @azolotko's reply to #111 (comment) ?

Yes, though of course you can check it yourself :)

jastice avatar Aug 31 '23 14:08 jastice

Can someone comment on the status of this PR? @jastice I suppose we're awaiting @azolotko's reply to #111 (comment) ?

Yes, though of course you can check it yourself :)

Yeah I was thinking the same 😄 👍 I primarily wanted to confirm that this PR is still relevant. Thanks!

izzyreal avatar Aug 31 '23 16:08 izzyreal

Can someone comment on the status of this PR?

@jastice I suppose we're awaiting @azolotko's reply to #111 (comment) ?

Oops 😬

I’ll give it another try tomorrow.

azolotko avatar Aug 31 '23 17:08 azolotko

Can someone comment on the status of this PR? @jastice I suppose we're awaiting @azolotko's reply to #111 (comment) ?

Oops 😬

I’ll give it another try tomorrow.

That would be great, but I'm also happy to look into it. I'll keep an eye out on this PR. Thanks in advance!

izzyreal avatar Sep 01 '23 05:09 izzyreal

Ok, I've rebased the PR and given it another try.

Here's a sample project that uses a locally built snapshot of sbt-ide-plugin from the azolotko:rudimentary-scala-3-support branch. The project uses Scala 3.3.0 and accesses both Scala 2 and Scala 3 standard library classes.

From the test run log:

2023-09-01 18:40:46,784 [  15818]   INFO - STDOUT - Illegal command line: hello from Scala 3 std lib
2023-09-01 18:40:46,784 [  15818]   INFO - STDERR - hello from Scala 2 std lib 

LGTM

azolotko avatar Sep 01 '23 16:09 azolotko

@azolotko Could you please also describe in words which issue this PR tries to fix? I don't recall any existing issues related to lack of Scala 3 support, which would be related to sbt-idea-plugin.

unkarjedy avatar Sep 01 '23 17:09 unkarjedy

When I initially created this PR, the problem was in sbt-idea-plugin not bundling Scala 3’s std lib, only Scala 2’s one.

Op vr 1 sep. 2023 om 19:09 schreef Dmitrii Naumenko < @.***>

@azolotko https://github.com/azolotko Could you please also describe in words which issue this PR tries to fix? I don't recall any existing issues related to lack of Scala 3 support, which would be related to sbt-idea-plugin.

— Reply to this email directly, view it on GitHub https://github.com/JetBrains/sbt-idea-plugin/pull/111#issuecomment-1703075548, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA26WB6ZGIRB22S4HX5V4TXYIJGFANCNFSM5CNV4IYQ . You are receiving this because you were mentioned.Message ID: @.***>

azolotko avatar Sep 01 '23 17:09 azolotko

Hm, I never thought of it before, but it looks like we have a broader issue here. I am now not sure if users of sbt-idea-plugin should be able to specify the exact Scala version (which is now the case, example 1, example 2)

This can lead to multiple scala-libraries in the classpath. For example, if the plugin depends on Scala Plugin or simply if the user installs multiple plugins which were built using sbt-idea-plugin. This can lead to errors at runtime.

On the other hand, there can be plugins developed with sbt-idea-plugin which do not depend on Scala Plugin and can work independently. So it looks like some plugins need to publish scala library (libraries) with them anyway.

So taking that, it's possible to have multiple plugins built using sbt-idea-plugin with multiple scala library jars, it would be at least good if those library versions are the same for all plugins.

Some thoughts on how we could achieve that:

  1. Extract responsibility of defining Scala 2, Scala 3 version into sbt-idea-plugin
  2. Change the versioning scheme for the sbt-idea-plugin closer to IntelliJ IDEA (2023.2.x, 2023.1.x)
  3. Do not change the "major" Scala 3 version in the same major version of sbt-idea-plugin. Note, the issue is less actual for Scala 2, because there will be no Scala 2.14, and changes in 2.13.x are not expected to break anything (though in theory there might be some issues even due to different minor issues)

This way we can be "more sure" that scala library versions from different plugins are the same.


UPD I just remembered that in IntelliJ IDEA, a special class loader is used for plugins (PluginClassLoader). It is isolates plugins classpaths to avoid runtime errors. So the issue described above is mostly actual if a plugin depends on Scala Plugin (e.g. "Big Data Tools" or "IntelliJ ZIO").

An alternative could be to do nothing. But in this case, every plugin developer will need to ensure they use the same Scala version as is used in Scala Plugin. (it's mostly about Scala 3 version)


@jastice, @pavelfatin Maybe you could also provide some thoughts on it?

unkarjedy avatar Sep 06 '23 14:09 unkarjedy

I will manually merge this PR and run it through our internal CI. This issue might still be relevant though: https://github.com/JetBrains/sbt-idea-plugin/pull/111#issuecomment-1708504077

unkarjedy avatar May 14 '24 16:05 unkarjedy

@azolotko Thanks for the PR, even though it took so long to merge it!

unkarjedy avatar May 14 '24 16:05 unkarjedy

It's merged and published in 3.26.0

unkarjedy avatar May 14 '24 17:05 unkarjedy