Skip to content

VS Code extension

The Elide extension for VS Code 1.105 or newer: project sync for Kotlin and Java code intelligence, the Elide sidebar, code lenses, tests, debugging, tasks and settings.

On this page

The Elide extension turns any folder with an elide.pkl into a VS Code project: it syncs dependencies and source sets into the Kotlin language server, and runs, tests and debugs through the elide CLI.

Requirements

RequirementNotes
VS Code 1.105 or newerDesktop VS Code or a remote/server build with a local filesystem.
Elide 1.5 or newerFound through elide.home, $ELIDE_HOME, the install locations, then PATH. Elide 1.6 needs extension 0.6.0 or newer.
Kotlin by JetBrainsJetBrains.kotlin-server; installed with the extension. Finish its first-run prompt.
A JDKFor code intelligence; set elide.jdk.home or $JAVA_HOME.

The extension needs a trusted workspace: a sync runs the workspace’s elide CLI.

Install

curl -LOJ "https://plugins.elide.dev/vscode/files?id=elide.elide"
code --install-extension elide-*.vsix

Help → Get Started → Get started with Elide walks through install, project, sync, run and test.

Sync a project

Opening a folder with elide.pkl syncs it: Elide resolves the manifest, installs dependencies when the lockfile is stale, and writes workspace.json for the Kotlin language server. Add workspace.json to .gitignore.

VS CodeSync and the Elide sidebar0:19Add a dependency to elide.pkl, reload when prompted, find it under Dependencies.
Status barMeaning
Elide with a checkIn sync
Elide with a spinnerSyncing
Elide: out of dateelide.pkl or the resolved dependencies changed
Elide, error-coloredSync failed; Elide: Show Output has the CLI log

Click the status bar item for the Elide menu: sync, run a command, run all tests, open elide.pkl or the output. When elide.pkl changes, the extension asks to reload (elide.sync.onManifestChange).

The Elide sidebar

The Elide view in the activity bar lists each project:

GroupRowsActions
Entrypointsjvm.main, entrypoint and scripts entriesRun, Debug
Tasksbuild, test, install, and Build targets from elide build --inspectRun, Debug on targets that take --debugger
Source setsEach source set and its roots
DependenciesResolved librariesReveal in the file manager

Code intelligence

Kotlin and Java completion, navigation and diagnostics come from the Kotlin language server, which imports the synced workspace.json: one module per source set, every library with its sources, the JDK and the manifest’s Kotlin options.

VS CodeKotlin code intelligence0:12After a sync, the Kotlin language server completes project members and shows inlay hints.
  • Sources jars are installed for declared Maven packages, so Go to Definition opens library code (elide.install.classifiers).
  • The JDK comes from elide.jdk.home, then jvm.javaHome, $JAVA_HOME, or an installed JDK matching jvm.target.
  • A checkout can keep an IntelliJ .idea directory: the extension sets intellij.buildTool to json in the workspace settings, so each editor reads its own model.

Run

Code lenses run what the project declares:

WhereLenses
Above a JVM main functionRun with Elide, Debug with Elide
jvm.main and entrypoint in elide.pklRun, Debug
scripts entriesRun script
artifacts entriesBuild; Native Image binaries also Run and Debug
VS CodeRun with Elide0:08The code lens above main runs the entrypoint with elide run in a task terminal.

Runs are VS Code tasks of type elide; compiler errors become Problems on the reported file and line.

CommandEffect
Elide: Run Elide Command…Run build, test, install or run <entrypoint> as a task.
Elide: Sync Project(s)Sync again.
Elide: Show MenuThe status bar menu.
Elide: New Project…Create a project from a template of the installed CLI.
Elide: Add Workspace Member…Create a project inside this one and add it to workspace.members.
Elide: Open generated Kotlin LSP workspaceOpen workspace.json.
Elide: Show OutputShow the CLI output and the sync log.

In .vscode/tasks.json:

{ "type": "elide", "command": "test", "args": ["src/api"], "options": { "bail": 3 } }
FieldValue
commandbuild, run, test or install
argsPositional arguments: build targets, test paths, the entrypoint
optionsCLI options: { "no-cache": true } adds --no-cache; false drops an inherited one
flags-f NAME[=VALUE] build flags
programArgsArguments after --
env, projectEnvironment; project root relative to the workspace folder

Test

JUnit tests in the test source sets appear in the Testing view, with gutter icons on each class and method. A run calls elide test --reporter=tap for the selection and reports each test as it finishes; a failure shows its assertion message and links to the failing line.

VS CodeTests in the Testing view0:10JUnit tests run through elide test and report per test.

The Debug profile runs the same tests under the debugger.

Run with Coverage runs the selection with --coverage and shows the result in the editor gutter and the Test Coverage view: JavaScript and TypeScript from LCOV, Java and Kotlin from a JaCoCo XML report. Request the XML report in elide.pkl:

import "elide:Coverage.pkl" as Coverage

coverage {
  jvm {
    reports { Coverage.xmlReport() }
  }
}
VS CodeRun with Coverage0:10Run the tests with coverage and read covered lines in the gutter and the Test Coverage view.

Debug

Debug with Elide starts elide run --debugger and attaches to it. Breakpoints in Kotlin and Java sources stop the program; ending the session stops Elide.

VS CodeDebug with Elide0:13Stop on a breakpoint and inspect variables in a Kotlin program run by Elide.

In .vscode/launch.json:

{
  "type": "elide",
  "request": "launch",
  "name": "Elide: Run (debug)",
  "entrypoint": "src/main/kotlin/shop/Main.kt"
}
FieldValue
commandrun (default), test, or build with targets
entrypointFile, script or entrypoint; empty uses the manifest’s
argsProgram arguments
elideArgs, options, flags, env, projectAs for tasks

elide.debug.adapter picks the debugger: intellij (default, from the Kotlin extension) or java (Debugger for Java). The debugger listens on port 5005, so one session runs at a time. For CDP and DAP debugging of JavaScript, TypeScript and Python, see Debugging.

Native Image

Launch type elide-native builds a Native Image artifact and debugs the binary under GDB, through the C/C++ extension (ms-vscode.cpptools):

{ "type": "elide-native", "request": "launch", "name": "Elide: Debug Native Image", "artifact": "bin" }

Add -g to the artifact’s options.flags in elide.pkl for source-level breakpoints; debug info is emitted on Linux only. program debugs an existing binary, build: false skips the build.

Workspaces

A manifest with workspace.members syncs as one build. Each member is a project in the sidebar, the Testing view, tasks and launch configurations, and code intelligence follows project("name") dependencies between members without a build. Opening a member’s directory offers to open the workspace root. See Workspaces.

Settings

SettingDefaultEffect
elide.home""Elide install root. Empty: $ELIDE_HOME, install locations, then elide on PATH.
elide.jdk.home""JDK for code intelligence.
elide.sync.onStartuptrueSync when the workspace opens.
elide.sync.onManifestChange"prompt"always, prompt or never.
elide.kotlinLsp.writeWorkspaceJsontrueWrite workspace.json.
elide.install.classifiers["sources"]Extra jars per Maven package: sources, docs.
elide.flags[]-f NAME[=VALUE] flags for every invocation, sync included.
elide.build.options{}Default options for elide build; elide.run.options, elide.test.options and elide.install.options likewise.
elide.codeLens.enabledtrueShow the Run and Debug code lenses.
elide.debug.adapter"intellij"intellij or java.
elide.debug.nativeMiMode"auto"gdb, lldb or auto for Native Image sessions.
elide.debug.miDebuggerPath""GDB or lldb-mi binary for Native Image sessions.

Was this page helpful?