Skip to content

improvement: Try and find latest supported semanticdb version #2097

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

Merged
merged 1 commit into from
Jul 3, 2023

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Jun 30, 2023

Previously, we wouldn't produce semanticdb files for older version of Scala since we wouldn't find the correct artifact if we stopped publishing for a particular version.

Now, we try and find the latest version that still supported that Scala version.

This is similar to the change we did in Metals in regards to the presentation compiler interface, where we would fetch old mtags for unsupported scala version and this way always support a particular version.

Will do a similar thing for our Metals sbt plugin if it makes sense.

@tgodzik tgodzik requested review from adpi2, ckipp01 and kpodsiad June 30, 2023 18:11
Comment on lines 74 to 85
def versionFuture =
Task {
coursierapi.Complete
.create()
.withScalaVersion(scalaVersion)
.withScalaBinaryVersion(scalaVersion.split('.').take(2).mkString("."))
.withInput(s"org.scalameta:semanticdb-scalac_$scalaVersion:")
.complete()
.getCompletions()
.asScala
.lastOption
}
Copy link
Collaborator

@kpodsiad kpodsiad Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick - versionFuture returns Task despite its name. Moreover, you're instantly converting it to future via versionFuture.runAsync(ExecutionContext.ioScheduler), maybe you could go to the Future directly on ExecutionContext.ioSchedulerz? There is no point in using Task in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I just wanted to be consistent, but maybe it doesn't really make sense. Changed!

Previously, we wouldn't produce semanticdb files for older version of Scala since we wouldn't find the correct artifact if we stopped publishing for a particular version.

Now, we try and find the latest version that still supported that Scala version.

This is similar to the change we did in Metals in regards to the presentation compiler interface, where we would fetch old mtags for unsupported scala version and this way always support a particular version.
@tgodzik tgodzik force-pushed the fallback-semanticdb branch from 062edc0 to c8d68ab Compare July 3, 2023 17:56
@tgodzik tgodzik merged commit d46a3fa into scalacenter:main Jul 3, 2023
@tgodzik tgodzik deleted the fallback-semanticdb branch July 3, 2023 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants