# IntelliJ IDEA plugin

> The Elide plugin for IntelliJ IDEA 2025.3 or newer: import projects and workspaces, run configurations, gutter actions, test results, coverage, debugging and the Elide distribution setting.

The Elide plugin imports a directory with `elide.pkl` the way IntelliJ IDEA imports a Maven or Gradle build, and runs,
tests and debugs through the `elide` CLI.

## Requirements

| Requirement | Notes |
| --- | --- |
| IntelliJ IDEA 2025.3 or newer | Community or Ultimate, with the bundled Java and Kotlin plugins. Kotlin code on Elide 1.6 needs IntelliJ IDEA 2026.2 or newer, whose Kotlin plugin reads Kotlin 2.5 libraries. |
| Elide | Found through the project's **Elide distribution** setting. Elide 1.6 needs plugin 0.9.3 or newer. |
| A JDK registered in the IDE | For JVM projects. |
| **Pkl** plugin (optional) | Completion, navigation and inspections in `elide.pkl`. |

## Install

In **Settings → Plugins → ⚙ → Manage Plugin Repositories**, add:

```text
https://plugins.elide.dev/intellij
```

Install **Elide** from the Marketplace tab and restart the IDE. Install **Pkl** from the same repository for
`elide.pkl` editing. Plugin ZIPs are also attached to each
[GitHub release](https://github.com/elide-dev/intellij/releases).

## Import a project

Open a directory that contains `elide.pkl` ([Projects](https://elide.help/docs/projects)). The plugin links it and syncs in the background.

- Each source set becomes a module; dependencies become libraries with sources and documentation attached.
- The project SDK is the JDK for `jvm.target`, or the newest installed JDK.
- Editing `elide.pkl` or the lockfile prompts a reload.
- The **Elide** tool window lists linked projects, their modules and the build targets under **Tasks**, runnable
  from the tree.

**File → New → Project → Elide** creates a project from the templates `elide init` offers.

### Workspaces

A manifest declaring `workspace.members` imports as one project. Every member gets its own modules, classpath and
JDK, and a `project("name")` dependency becomes a module dependency, so the IDE compiles and navigates across members.
Only the root is linked; editing a member's manifest reloads the workspace. See
[Workspaces](https://elide.help/docs/elide-pkl-reference#workspaces).

## Run

Create an **Elide** run configuration. Its command line takes anything the CLI accepts, with completion for
commands, flags, entrypoints and the project's build tasks:

```text
run
test -t 'MyTest'
build -- --flag-for-the-tool
serve --port 8080
```

| Gutter icon on | Actions |
| --- | --- |
| A Kotlin or Java `main` function | Run, Debug |
| A JUnit test class or method | Run, Debug |
| `jvm.main`, `entrypoint` and `scripts` in `elide.pkl` | Run, Debug (Pkl plugin) |
| `artifacts` entries in `elide.pkl` | Build; a Native Image binary also Run, Debug (Pkl plugin) |

**Run Anything** (double Ctrl) accepts `elide …`. `elide build` reports to the **Build** tool window as a step tree
with timings and compiler diagnostics; other commands report to **Run**.

## Test

An `elide test` configuration reports into the test runner: a tree with pass, fail and skip states, timings, output
and jump to source for JVM tests.

**Run with Coverage** adds `--coverage` and loads the JaCoCo and LCOV reports into the coverage view, including
reports from runs started outside the IDE.

## Debug

**Debug** on an Elide run or test configuration adds `--debugger` and attaches the IDE's JVM debugger on port `5005`.
It debugs JVM code; for JavaScript, TypeScript and Python use the CDP or DAP debugger in
[Debugging](https://elide.help/docs/debugging#attach-a-debugger).

**Run Native Image** and **Debug Native Image** on a Native Image artifact build it and run or debug the binary with
GDB or LLDB. Debugging needs the **Native Debugging Support** plugin (IntelliJ IDEA Ultimate) and `-g` in the
artifact's `options.flags`; images carry debug info on Linux only.

## Settings

**Settings → Build, Execution, Deployment → Build Tools → Elide**:

| Setting | Effect |
| --- | --- |
| **Elide distribution** | *Auto-detect* or a custom path. |
| **Native Image debugging** | Debugger (*Auto*, *GDB* or *LLDB*) and the GDB executable. |

Auto-detect checks `$ELIDE_HOME`, then:

| Platform | Locations, in order |
| --- | --- |
| Unix | `$XDG_DATA_HOME/elide`, `~/.local/share/elide`, `/opt/elide/current`, `~/.elide` |
| Windows | `%LOCALAPPDATA%\elide`, `%ProgramFiles%\Elide`, `%USERPROFILE%\.local\share\elide`, `%USERPROFILE%\.elide` |
