-
Notifications
You must be signed in to change notification settings - Fork 5.2k
feat: Add kotlin lsp integration #6601
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
Conversation
|
/review |
| export const KotlinLS: Info = { | ||
| id: "kotlin-ls", | ||
| extensions: [".kt", ".kts"], | ||
| root: NearestRoot(["build.gradle", "build.gradle.kts", "settings.gradle.kts", "pom.xml"]), |
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.
Hello, thanks for your work on this. I am really looking forward to it!
But in my opinion, this currently doesn't correctly support multi-project structures, as it would detect a subproject/module as root.
I would suggest:
root: (start) =>
// 1) Nearest Gradle root (multi-project or included build)
NearestRoot(["settings.gradle.kts", "settings.gradle"])(start) ??
// 2) Gradle wrapper (strong root signal)
NearestRoot(["gradlew", "gradlew.bat"])(start) ??
// 3) Single-project or module-level build
NearestRoot(["build.gradle.kts", "build.gradle"])(start) ??
// 4) Maven fallback
NearestRoot(["pom.xml"])(start),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 catch that should be fixed
This pull request adds support for the Kotlin language server to the OpenCode LSP infrastructure. The main changes include updating language extension mappings and introducing logic to automatically download, install, and launch the Kotlin Language Server when needed.
Kotlin Language Server Integration
.ktand.ktsfile extensions to theLANGUAGE_EXTENSIONSmapping, associating them with the Kotlin language.KotlinLSentry inLSPServer, which detects the project root, checks for a local server installation, and downloads/releases the latest Kotlin Language Server from GitHub if not present. The implementation also handles platform and architecture compatibility, extraction, and launching of the server process.