Language Server for Kotlin by Bitno
A private, fast and secure Kotlin language server for VS Code.
Early development: this extension is still being built. Expect missing features, rough edges and breaking changes between versions.
Private, fast and secure by design
Built by a developer, for developers, from Serbia. Free, because developer tools should be.
- Private: Your editor, your business: no telemetry, no account, and your code stays on your machine.
- Fast: Starts only when you need it, and does just the work you ask for.
- Secure: Installs nothing it hasn't verified, and never keeps a password in plain text.
Supported
Features
- Diagnostics as you type, with unused variables and imports greyed out and uses of deprecated code struck through
- Your build's compiler plugins in the analysis: all-open with its Spring preset, no-arg and
kotlinx.serialization, so Spring and serialization projects get no false errors and complete what the plugins generate, such as serializer()
- Completion of the names in scope, members and extensions, and of classes and functions that aren't imported yet, with their import
- Smart completion (Ctrl+Shift+Space) of only what fits, and a second Ctrl+Space for more: constructors, enum entries, a sealed class's subclasses, lambdas, named arguments and a
when's missing branches
- Postfix templates
.val, .for, .if, .null and .return, and sout and main
- New Kotlin Type… and a New Kotlin explorer submenu: class, interface, object, enum class, data class and sealed class, with the package from the folder
- Hover, and a Documentation view that follows the cursor
- KDoc coloured as Markdown: code, bold, italics, links and tags
- Go to definition in the project's Kotlin and Java sources, and go to super method (Ctrl+U) from an
override to the member it overrides, in your sources or a library's
- Complete statement (Ctrl+Shift+Enter): adds the missing
)s, and the braces after an if, else, loop, when, function or class header
- Optimize imports, also on save: removes unused and duplicate imports, adds the ones only one class or function fits, and sorts them in Kotlin's default order
- Bracket matching, comment toggling and auto-closing of brackets and quotes in
.kt files
- Run JUnit tests, backticked names included, and JMH benchmarks from the gutter and the Test view, through Language Server for Gradle by Bitno
- Run a
fun main or a @JvmStatic one from the editor's Run button, or from Run and Debug and launch.json with its arguments, JVM options and environment, through Language Server for Gradle by Bitno, in a terminal of its own that takes the program's input
- Formatting with your build's own Spotless steps (ktlint or ktfmt), unsaved changes included, run through Language Server for Gradle by Bitno, so the editor formats like
spotlessApply
Coming soon
- Syntax colouring
- Find references
- Rename
- Outline
- Library sources
- Build scripts (
.kts)
Requirements
- VS Code 1.145 or later.
- Platform for the JVM by Bitno, which runs the server. VS Code installs it with this extension.
- A Gradle or Maven build (see Build Tools), and Language Server for Gradle by Bitno or Language Server for Maven by Bitno, which imports it. Bitno Pack for Kotlin installs them all.
- Network access on the first start. The server runs on a JDK of its own Java version, which the extension downloads into
~/.jdks (about 140 MB) when it isn't there yet. You don't need to install a JDK for the server yourself.
- About 90 MB of disk space for this extension, which bundles Kotlin's analysis.
Getting started
Open a folder that contains a Gradle build or a pom.xml and open a Kotlin file. The first start downloads the server's runtime and imports the build. The {} beside the language mode shows what the server is doing; work that takes longer than 10 s also shows a notification, and downloads show at once in notifications you can cancel.
Settings
The settings belong to Platform for the JVM by Bitno, the extension that runs the server and is installed with this one.
| Setting |
Default |
Description |
bitno.jvm.jdk.download |
ask |
Whether to download a JDK when a project needs a JDK that isn't installed: ask, always or never. |
bitno.jvm.log.level |
info |
How much the server writes to its output channel. |
bitno.jvm.server.maxHeap |
empty |
The server's most memory, as 4g or 2048m; empty leaves it to Java. Applies from its next start. |
- Adoptium, over HTTPS: the server's Java runtime on first start, and a project's missing JDK once you agree.
- Your Gradle builds: loaded by Language Server for Gradle by Bitno, which this extension needs. Its Gradle fetches what your build needs from the repositories it already uses, and hands each build to this server over a socket on your machine.
- Your Maven builds: loaded by Language Server for Maven by Bitno, which this extension needs for them. It reads your POMs and fetches the POMs and jars your build needs from the repositories your POMs and
~/.m2/settings.xml name, runs Maven only to compile, and hands each build to this server over a socket on your machine.
- Nothing else. Messages in the editor never show error details, paths or Gradle's and Maven's output; those go to the log.
Feedback
Found a bug, or missing something? Open an issue. Questions and ideas go there too, as a question. Blunt feedback is welcome.
Kotlin is a trademark of the Kotlin Foundation.
| |