-
Notifications
You must be signed in to change notification settings - Fork 216
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
Pick Kotlin stdlib based on compiled Kotlin version #398
base: main
Are you sure you want to change the base?
Conversation
omar25h
commented
Oct 1, 2022
- Ignore path when comparing versions
- Pick the local Kotlin stdlib version based on the compiled version. This prevents potential issues in case there are multiple Kotlin versions used on the same machine.
- Ignore path when comparing versions - Pick the local Kotlin stdlib version based on the compiled version. This prevents potential issues in case there are multiple Kotlin versions used on the same machine.
abca91b
to
46f0db4
Compare
@@ -116,6 +106,6 @@ private fun compareVersions(left: Path, right: Path): Int { | |||
return -leftVersion.size.compareTo(rightVersion.size) | |||
} | |||
private fun extractVersion(artifactVersionDir: Path): List<String> { | |||
return artifactVersionDir.toString().split(".") | |||
return artifactVersionDir.toString().split("/").last().split(".") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return artifactVersionDir.toString().split("/").last().split(".") | |
return artifactVersionDir.fileName.toString().split(".") |
} | ||
else -> name.startsWith(artifact) && name.endsWith(".jar") | ||
} | ||
name == "$artifact-${KotlinVersion.CURRENT}.jar" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses the language server's version of Kotlin, right? This might go wrong if the user has a different version of Kotlin installed than what the language server uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. However, I think we need a better way to figure out the Kotlin version in the project on which the LSP runs, maybe via extracting the version from the Gradle configuration, if possible.
The current implementation uses the first version it finds, which also doesn't necessarily match the Kotlin version used in the project.