Repository navigation
Kotlin LSP support #3116
Description
Activity
first class support makes sense, as for lsp file path issues that may be an issue we have with windows…
@itsrainingmani have u noticed any lsp issues on windows?
I think
kotlin‑lspworks with opencode.ai on Unix‑like systems, including WSL.
I use it on both Linux and macOS with the following setup:- Follow the installation instructions at https://github.com/Kotlin/kotlin-lsp.
- Add the following configuration to your
opencode.json:
{ "$schema": "https://opencode.ai/config.json", "provider": { "llama-cpp": { "npm": "@ai-sdk/openai-compatible", "name": "Llama.cpp (local)", "options": { "baseURL": "http://localhost:11434/v1" }, "models": { "gpt-oss-20B": { "name": "unsloth/gpt-oss-20b-GGUF:Q4_K_M" } } } }, "lsp": { + "kotlin-lsp": { + "command": ["kotlin-lsp"], + "extensions": [".kt"] + } } }Hmm, will try. When i tried to specify kotlin-lsp.sh command i got no response. Or maybe due to --stdio parameter...
the lsp generally works but i think opencode hasn't yet implemented pull-style diagnostics. the same was the case for the helix editor (which added support just three weeks ago, the pull-flow appears to be rather new)
Has anyone managed to get Kotlin LSP working in opencode?
I tried both:
kotlin-lspfwcd/kotlin-language-server
by configuring them as an lsp in my
opencode.json(based on https://opencode.ai/docs/lsp/#custom-lsp-servers), but I couldn’t get either of them to work.Reacted by Nathanial DooseAny updates on this feature request?
Documentation said kotlin-lsp is now auto installed, but it seems it doesn't work.
At least opencode lsp debug diagnose responses with empty json object - {}Reacted by Junyoung, Sung, Yongwoo Yu (Yowu), Adam Karepin, Ilya Usanov, Junerver Hou, Krzysztof Karczewski, XiaoChao Fang, Gabriel Patzleiner, stay7, Zhao Zuohong and 5 morehow can we check, if it is working as expected?
Edit:
Found the following out with"lsp": { "kotlin-ls": { "disabled": true }, "kotlin-lsp": { "command": ["kotlin-lsp", "--stdio"], "extensions": [".kt", ".kts"] } }installed https://github.com/Kotlin/kotlin-lsp via brew
Opencode LSP Tool Command Input Type Works? What I observed Workspace symbol search opencode debug lsp symbols string Partially Command runs, but returns [] for Kotlin queries (TheClass, FQN). Document symbols opencode debug lsp document-symbols (must be URL) Yes Works with file:///…/TheClass.kt; fails with plain file path (cannot be parsed as a URL). Returns full symbol tree. Diagnostics opencode debug lsp diagnostics path Yes Works with plain file path; for tested Kotlin file returns {} (no diagnostics surfaced). BUT: I couldn't get opencode to use the information. It doesn't even notice that kotlin-lsp is there, even though it's displayed in the sidebar:

I went through the code and... it's a mess. I'm seriously considering not using opencode anymore :D
But what I found out, for example, is that the cos are wrong. It definitely uses kotlin-lsp () and not kotlin-ls.
I'll try to fix a few bugs, update the docs, and create a PR for it.
Here's a summary after the analysis:
- Built-in Kotlin LSP is Kotlin/kotlin-lsp (JetBrains), not fwcd: the built-in server is id: "kotlin-ls" but it downloads from https://api.github.com/repos/Kotlin/kotlin-lsp/releases/latest and launches kotlin-lsp.sh/kotlin-lsp.cmd. See packages/opencode/src/lsp/server.ts:1231. - fwcd/kotlin-language-server is not used anywhere: repo search finds no references to fwcd / kotlin-language-server (only the docs/config examples from the issue discussion; not in code). - Why diagnostics don’t reach the agent: - The LSP client only consumes push diagnostics via textDocument/publishDiagnostics (packages/opencode/src/lsp/client.ts:52). - There is no implementation for pull diagnostics (textDocument/diagnostic / workspace/diagnostic) in packages/opencode/src/lsp/*, so servers that primarily use pull-diagnostics will produce {} in LSP.diagnostics() even if they’re “working”. - Even when diagnostics exist, they’re only appended to tool outputs after write-like actions (write/edit/apply_patch) (packages/opencode/src/tool/write.ts:56, packages/opencode/src/tool/edit.ts:132). A normal read just “warms” LSP without waiting (packages/opencode/src/tool/read.ts:132). - Why symbol info doesn’t reach the agent (this one is a hard blocker): - The HTTP route that should expose workspace symbol search is currently stubbed to always return [] (packages/opencode/src/server/routes/file.ts:86). - The lsp tool’s workspaceSymbol operation ignores the user query and calls LSP.workspaceSymbol("") (packages/opencode/src/tool/lsp.ts:72), so even direct tool usage is effectively broken for searching. - Docs are misleading/out-of-date for Kotlin naming: packages/web/src/content/docs/lsp.mdx:30 lists kotlin-ls as the built-in server, but doesn’t mention it actually installs/launches kotlin-lsp from Kotlin/kotlin-lsp—easy to interpret as a different server.Reacted by Gabriel Patzleiner, burningfireplace, Junyoung, Sung, XiaoChao Fang, RichyRen, Zhao Zuohong, Naowal Rahman, Joel Handwell, Ryan Hintze, GamesIS and 5 moreTo stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
Reopen this, it should use the official Kotlin LSP where possible and in an efficient manner
Reacted by Gabriel Patzleiner, Roman Makarewicz, burningfireplace, Filip Wiesner, GamesIS, Juan Liska, Mankin, Eduard Hildebrandt and Sergio Sánchez VallésReopen this issue, it's still a problem
Reacted by GamesISI can confirm. Kotlin LSP isn’t working for me either. I tried the default Kotlin LSP configuration (kotlin-ls) as well as a custom setup using https://github.com/Kotlin/kotlin-lsp, and neither worked. Please reopen this issue.
- marked Kotlin LSP not working (timeouts, no pull-diagnostics, etc.) #23873 as a duplicate of this issue
on Apr 22, 2026

There are not that bad LSP server for kotlin. I'm struggling to connect it (im on a windows), maybe im doing something wrong. But having a first-class support for it would be great: https://github.com/Kotlin/kotlin-lsp
Problem when im trying to connect it on windows is that opencode sends wrong file paths to it, like file:///C:\dir\file, or something like that. I tried to use WSL, but it doesn't responds to queries. Or does latter means, that Kotlin LSP just isn't ready for opencode yet? Not sure that it supports all necessary functions right now