Evaluate Kotlin worksheet files in VS Code.
Install from the Visual Studio Marketplace
Files ending in .worksheet.kts can be run with Kotlin Worksheet: Run. Use
Run Selection or Run Current Block to evaluate focused code without
disturbing unrelated results. Run-on-save is available as an optional setting.
val x = 40 // => 40
x + 2 // => 42
println("hello") // => hello
Requirements
- VS Code 1.100 or newer
- A local Kotlin compiler on PATH, or configure
kotlinWorksheet.kotlinCommand - Kotlin syntax highlighting from a Kotlin language extension. This extension packs
fwcd.kotlin.
Supported Kotlin compiler for CI and local examples: kotlinc-jvm 2.4.0.
Use kotlinWorksheet.executionMode to choose between local kotlinc, Gradle classpath resolution, or automatic detection.
The current support baseline is VS Code 1.100+, Kotlin 2.4.0, and macOS, Linux, or Windows. See the support matrix for Gradle limitations.
Set Up Kotlin
Check whether the Kotlin compiler is available:
kotlinc -version
If the command is unavailable, install Kotlin with one of these options:
# macOS with Homebrew
brew install kotlin
# SDKMAN
sdk install kotlin
# mise
mise use --global [email protected]
Restart VS Code after installing Kotlin so the extension can detect the updated PATH. If kotlinc is installed elsewhere, set its path in VS Code settings:
{
"kotlinWorksheet.kotlinCommand": "/absolute/path/to/kotlinc"
}
Set kotlinc
- Run
kotlinc -versionand result must be likeinfo: kotlinc-jvm 2.x.10 (JRE 2x.xxx) - (If there is no kotlinc please install by using
sdk install kotlinthen check again - Run
which kotlincand result should be like${HOME}/.sdkman/candidates/kotlin/current/bin/kotlinc - Copy and then paste kotlinc path into "Kotlin Worksheet: Kotlin Command" in plugin setting
Install For Users
Install from the Visual Studio Marketplace:
- Open Kotlin Worksheet on the Visual Studio Marketplace.
- Click
Install. - Open a trusted workspace in VS Code.
- Create a file ending in
.worksheet.kts. - Run
Kotlin Worksheet: Run.
Install from a local VSIX if you are testing an unreleased build:
- Download or build
kotlin-worksheet-0.6.0.vsix. - Open VS Code.
- Run
Extensions: Install from VSIX...from the Command Palette. - Select
kotlin-worksheet-0.6.0.vsix. - Open a trusted workspace.
- Create a file ending in
.worksheet.kts. - Run
Kotlin Worksheet: Run.
Install the Kotlin compiler if kotlinc -version does not work in your terminal. After installing Kotlin, restart VS Code so the extension can see the updated PATH.
Commands
Kotlin Worksheet: RunKotlin Worksheet: Run SelectionKotlin Worksheet: Run Current BlockKotlin Worksheet: Clear ResultsKotlin Worksheet: New WorksheetKotlin Worksheet: Toggle Run On SaveKotlin Worksheet: Toggle Render ModeKotlin Worksheet: Check EnvironmentKotlin Worksheet: Show Log
Settings
kotlinWorksheet.kotlinCommand: command used to run Kotlin scripts, defaultkotlinckotlinWorksheet.runOnSave: run.worksheet.ktsfiles on save, defaultfalsekotlinWorksheet.renderMode: show results asinlineCommentsordecorations, defaultinlineCommentskotlinWorksheet.executionMode: chooseauto,localKotlinc, orgradleClasspath, defaultautokotlinWorksheet.timeoutMs: execution timeout in milliseconds, default10000kotlinWorksheet.maxResultLength: maximum displayed result length, default500
Support
If Kotlin Worksheet is useful to you, you can support its development on Buy Me a Coffee.
Development
pnpm install
pnpm compile
pnpm test
Run the full local verification before packaging or release:
pnpm check
Docs
docs/user-guide.mddocs/examples.mddocs/architecture.mddocs/development.mddocs/publishing.mddocs/production-readiness.mddocs/roadmap-to-1.0.0.mddocs/roadmap-0.5.0.mddocs/ux-confidence-release.mdCHANGELOG.mdCONTRIBUTING.md