Gradle Kotlin CompanionA VS Code extension that brings a JetBrains-style Gradle / Kotlin-DSL
experience to Visual Studio Code, on top of (and complementing) the
official HighlightsModules & tasks
Build script integration
Version catalog (
|
| Tool reference | Purpose |
|---|---|
#gradle (gradle_run) |
Run any task with optional args. |
#gradleTasks (gradle_tasks) |
Bulleted list of tasks under a project path. |
#gradleDependencies (gradle_dependencies) |
Dependency tree for a project path. |
#libsCatalog (libs_catalog_read) |
Parsed libs.versions.toml as JSON. |
#gradleDependencySearch (gradle_dependency_search) |
Maven Central dependency coordinates with latest versions. |
An init script (resources/gradle-kotlin.init.gradle.kts) is injected
via -I for every invocation; disable with
gradleKotlin.initScript.enabled = false or point to your own with
gradleKotlin.initScriptPath.
Gradle for Java takeover
Gradle for Java starts its own Gradle task discovery and can also wire a Java Gradle Build Server into Java project import. Gradle Kotlin Companion treats that extension as something to take over by default, using only public VS Code settings so the behavior is explicit and reversible:
- routes task runs, task hydration, reloads, wrapper upgrades and daemon status checks through the same serialized Gradle runner;
- uses
--daemonby default for its own Gradle invocations, so repeated Gradle Kotlin Companion tasks reuse the Gradle daemon; - sets workspace
gradle.autoDetect = off, so Gradle for Java does not also auto-discover Gradle tasks; - sets workspace
java.gradle.buildServer.enabled = off, so Gradle for Java does not keep its Gradle Build Server path alive.
Set gradleKotlin.gradleForJava.integrationMode = "coexist" if you need
to keep Java Gradle Build Server enabled while still letting this
extension own task discovery, or "off" to leave Gradle for Java untouched.
Disable eager task hydration with
gradleKotlin.taskDiscovery.autoHydrateOnActivation = "never".
Force no-daemon behavior with gradleKotlin.daemon.mode = "never"; the
default "auto" uses --daemon.
Sample project
sample/ contains a multi-module Kotlin/Gradle project (:app,
:core, :modules:featureA, :modules:featureB) wired up with a
gradle/libs.versions.toml version catalog. Open the sample/ folder
to see the sidebar, code lenses, inlay hints and Test Explorer in
action.
Commands
| Command | Default location |
|---|---|
Gradle: Refresh Modules |
View title $(refresh) |
Gradle: Reload Project |
View title + editor title |
Gradle: Run Task |
Tree item inline $(play) |
Gradle: Run Task with Arguments… |
Tree item inline $(edit) |
Gradle: Run Tests in Task… |
Tree item inline $(beaker) |
Gradle: Re-run Recent |
Recent-runs item $(debug-rerun) |
Gradle: Clear Recent Runs |
View title $(trash) |
Gradle: Show Dependencies |
CodeLens above dependencies { } |
Gradle: Add Subproject… |
CodeAction in settings.gradle(.kts) |
Gradle: Open Module Build File |
Module item context |
Gradle: Stop Daemon |
Status-bar click |
Configuration
| Setting | Default | Description |
|---|---|---|
gradleKotlin.gradleCommand |
empty | Override the Gradle command. |
gradleKotlin.versionInlayHints.enabled |
true |
Show ghost-text versions next to libs.*. |
gradleKotlin.versionInlayHints.checkLatest |
true |
Query Maven Central and surface current -> latest. |
gradleKotlin.codeLens.enabled |
true |
Show top-of-file Reload / Dependencies lenses. |
gradleKotlin.daemon.enabled |
true |
Allow daemon usage when gradleKotlin.daemon.mode permits it; disable to always pass --no-daemon. |
gradleKotlin.daemon.mode |
auto |
Use --daemon by default for shared Gradle Kotlin Companion task execution; can be forced to never. |
gradleKotlin.initScript.enabled |
true |
Inject an init script via -I for every daemon invocation. |
gradleKotlin.initScriptPath |
empty | Override the init script path; defaults to the bundled one. |
gradleKotlin.gradleForJava.integrationMode |
takeover |
Disable Gradle for Java task auto-detection and Java Gradle Build Server for the workspace; use coexist or off to loosen that. |
gradleKotlin.taskDiscovery.autoHydrateOnActivation |
auto |
Eagerly hydrate dynamic tasks through the shared daemon unless set to never. |
Development
bun install
bun run compile
bun run test # vitest unit tests with stubbed `vscode`
bun run test:e2e # @vscode/test-electron smoke test (downloads VS Code)
To regenerate icons from the JetBrains expui set:
bun run icon
License
MIT.