Skip to content
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

Prioritize build targets with supported Scala versions. #948

Merged
merged 1 commit into from Sep 27, 2019

Conversation

@olafurpg
Copy link
Member

olafurpg commented Sep 27, 2019

Previously, if two build targets in the repo were eligible for a source
file, Metals would sometimes prioritize a target with an unsupported
Scala version over a target with a supported Scala version. This
resulted in completions/hover/parameterHints not to work while editing
cross-built sources.

This PR introduces a change to the logic where we select a build target
for a given source file. Now we sort the elibible candidates by two
criteria: the Scala version and the platform (JVM/JS/Native). This
change takes the first step towards
scalameta/metals-feature-requests#13, which is
about making this logic configurable.

Previously, if two build targets in the repo were eligible for a source
file, Metals would sometimes prioritize a target with an unsupported
Scala version over a target with a supported Scala version. This
resulted in completions/hover/parameterHints not to work while editing
cross-built sources.

This PR introduces a change to the logic where we select a build target
for a given source file. Now we sort the elibible candidates by two
criteria: the Scala version and the platform (JVM/JS/Native). This
change takes the first step towards
scalameta/metals-feature-requests#13, which is
about making this logic configurable.
@jvican
jvican approved these changes Sep 27, 2019
Copy link
Collaborator

jvican left a comment

LGTM! Excited to try this out 😊

val isSupportedScalaVersion = scalaInfo(t).exists(
t => ScalaVersions.isSupportedScalaVersion(t.getScalaVersion())
)
if (isSupportedScalaVersion) score <<= 2

This comment has been minimized.

Copy link
@jvican

jvican Sep 27, 2019

Collaborator

Nice👌

Copy link
Collaborator

tgodzik left a comment

LGTM 🎋

@olafurpg olafurpg merged commit 679cd64 into scalameta:master Sep 27, 2019
2 checks passed
2 checks passed
build
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@olafurpg olafurpg deleted the olafurpg:inverse-sources branch Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.