VS Code · Kotlin Toolchain
Kotlin, in VS Code, when the build is a module.yaml
JetBrains builds editor support for its Kotlin Toolchain into IntelliJ IDEA and nowhere else. This extension is the rest of it for VS Code: a language server of its own that reads what the toolchain built, and the toolchain's build, run, test and debug one click away. Nothing else needs installing — not even the toolchain.
# the extension — or search the Extensions view for “Kotlin Toolchain” $ code --install-extension optersoft.kotlin-toolchain # then open a folder with a module.yaml in it, or an empty one and run # Kotlin: New Project
The gap it fills
The official Kotlin language server imports Gradle, Maven, Bazel and JPS projects. It does not import Kotlin Toolchain ones (kotlin-lsp#218), so opening one gives you colours and nothing else: println resolves to nothing, every library import is an unresolved reference, and a call into a sibling module is a mystery.
This extension answers those files itself. And if you do install JetBrains’ extension, it takes the .kt files back and this one describes your project to it — the workspace.json that server was waiting for and nobody was writing.
What you get
Syntax errors as you type
From a parser of the extension’s own, on every keystroke — no build, no JVM, no project. It works in a folder you made a minute ago, and it is checked against the Kotlin compiler’s own parser so it does not squiggle code that is fine.
The compiler’s answers
Errors, completion, hover and go-to-definition come from the Kotlin compiler’s analysis, run on the exact classpath the toolchain built with — across every module of the project, multiplatform source sets and Compose’s checkers included.
Completion that lands the way Kotlin is written
map { } rather than map(), extensions after a dot, auto-imports, the branches a when is still missing, overrides as whole declarations, parameter names, and postfix templates like .notnull.
Run, Debug, Watch, Test
A lens on every module.yaml and above every fun main. Debug runs your program under the toolchain and attaches, so what you debug is what you run. Watch reruns it on save — or swaps the changed classes into the running JVM.
A Test Explorer
The tests are found by reading the sources, so the tree is there before anything ran. Results come from the engine’s own stream — JUnit, kotlin.test and kotest — with the assertion’s expected/actual as a diff.
A manifest editor that knows your project
Completion and hover for every setting, generated from the toolchain’s own model. Dependency lines offer your modules as the //paths the toolchain wants, your catalog, the catalogs the toolchain generates, and Maven Central.
The toolchain’s own diagnostics
What kotlin reports about a manifest lands on the token it is about, with a quick fix where one exists — plus the two mistakes the toolchain never mentions: a mainClass with no fun main, and a module no project lists.
Compose Hot Reload
A supervised session with its own lens, status item and terminal: edit, save, and the running window recomposes. Compile errors from each rebuild go to the Problems panel.
Formatting, outline, folding
Format Document fixes indentation and trailing whitespace and nothing that is a matter of taste. The outline, folds and Expand Selection come from the same parse tree, so they work in a file that does not compile.
Getting started
There is no toolchain to install on the machine. The kotlin command is a small script that pins a version and downloads the rest on first use, and a project carries its own — exactly as Gradle’s wrapper does. The extension writes it for you, checked against the SHA-256 JetBrains publishes.
- Install the extension. It requires no other extension.
- Open an empty folder and run Kotlin: New Project. Pick one of the real
kotlin inittemplates; the project is created in the folder you have open. - Press Run on the manifest. The first build downloads the toolchain the wrapper pins; everything after that is local.
# module.yaml — each line of it completes, hovers and Ctrl-clicks product: jvm/app dependencies: - //shared - $libs.kotlinx.coroutines.core - com.squareup.okhttp3:okhttp: ← completion offers the versions
Already have a project? Open its folder; a module.yaml or project.yaml is all it looks for. The guide walks through the rest, with the measurements.
How it works
It reads what the build decided
The classpath, the source roots and the compiler settings come from the files the toolchain writes when it builds — the exact jars it fed the compiler, conflicts already resolved. Nothing is re-derived from a dependency tree.
A Rust language server
Parsing, highlighting, formatting, the manifest features and the project model are a small Rust binary bundled in the extension, per platform. Any editor that speaks LSP could use it.
The Kotlin compiler for what only it knows
Types, resolution and the compiler’s diagnostics come from Kotlin’s own analysis engine, out of jars the toolchain already downloaded — in a JVM started only for a project that has Kotlin in it.
Everything in one download
The server, its parser and the manifest schema ship inside the extension. Kotlin’s analysis engine is not downloaded by us at all — it is read out of the toolchain your project already uses.
Privacy
It collects nothing about you. No telemetry, no analytics, no crash reports, no identifiers, no account. A request leaves your machine only when you do one of three things, and carries only what the table says:
| When | To | What is sent |
|---|---|---|
| You type a Maven coordinate in a dependency line | central.sonatype.com | The characters typed in that line |
| You complete the version after group:artifact: | repo1.maven.org | That group and artifact |
| New Project or Add Wrapper, on a machine with no kotlin | kotl.in, packages.jetbrains.team | A request for JetBrains’ wrapper script and its checksum |
Setting kotlin.dependencies.searchMavenCentral to false turns off the first two. Libraries already on your disk are still offered. The third only happens when there is no toolchain yet, and you avoid it by installing one yourself. The programs the extension starts for you — the Kotlin toolchain, Android’s sdkmanager — are their publishers’, and so is their traffic.
Free to use, for any purpose including commercial work. Not open source: the extension ships as a binary under Optersoft’s licence, with the notices of the open-source components it bundles. Built by Optersoft — a third-party client for a JetBrains tool, not a JetBrains product. Bugs and questions: support@optersoft.com.