Skip to content

Conversation

@tjg184
Copy link
Contributor

@tjg184 tjg184 commented Jan 1, 2026

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

  • Added .kt and .kts file extensions to the LANGUAGE_EXTENSIONS mapping, associating them with the Kotlin language.
  • Introduced the KotlinLS entry in LSPServer, 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.

@rekram1-node
Copy link
Collaborator

/review

@tjg184 tjg184 requested a review from rekram1-node January 2, 2026 18:53
@rekram1-node rekram1-node merged commit 586207a into anomalyco:dev Jan 2, 2026
2 checks passed
export const KotlinLS: Info = {
id: "kotlin-ls",
extensions: [".kt", ".kts"],
root: NearestRoot(["build.gradle", "build.gradle.kts", "settings.gradle.kts", "pom.xml"]),
Copy link
Contributor

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),

Copy link
Collaborator

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

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.

3 participants