# Build diagnostics in Tern

> javac and kotlinc diagnostics in Tern: cards in the Build view and build lens, marks in the source editor, the status bar count, and diagnostics.json.

A compiler error stops being a wall of text. In Tern, each javac and kotlinc error, warning and note from `elide build`
becomes a card with its source excerpt, its notes and a link to the location; cards are grouped by file. Press
**Open** and the source editor shows the same error on its line.

| Where | What it shows |
| --- | --- |
| `elide build` in a Tern terminal | The Build view: state, counts, task progress and the cards. See [Terminal surfaces](https://elide.help/docs/tern-terminal#elide-build-in-tern). |
| **Build project** in the workspace | The full Build page, with **Rebuild** (`r`). |
| `elide javac …`, `elide kotlinc …` | The plugin's build lens: counts and cards per file, with an **Open** link per location. |
| The source editor | The **Diagnostics** overlay on the file's lines. |
| The status bar | The pane's last build, for example `Build failed · 3 errors, 1 warning`. |

Each card's **Open** button, and the location link, open the file at the line in the
[source editor](https://elide.help/docs/tern-workspace#source-editor).

## Source editor

The **Diagnostics** overlay appears once the project has a build report. On each line with a diagnostic it draws:

| Mark | Meaning |
| --- | --- |
| `●` in the gutter | Error. |
| `▲` in the gutter | Warning. |
| `•` in the gutter | Note. |
| Tinted row and a dotted underline at the column | The diagnostic's location. |
| Message beside the line | The first message; `+N` when the line has more. |

`F8` and `⇧F8` move to the next and previous diagnostic. The toolbar badge and status bar show the file's counts. A
diagnostic whose line no longer matches its excerpt is hidden until the next build; undo brings it back.

## Report

Each `elide build` in a Tern terminal writes `.dev/reports/build/tern/<run>/` in the project:

| Field or file | Content |
| --- | --- |
| `diagnostics.json` | At most 500 diagnostics, with exact error and warning counts beyond that, and `finished_ms`, the run's end in Unix milliseconds. |
| `progress.log` | The last 1 MiB of the build's error stream. |
| `.dev/reports/build/tern/latest` | The newest run's directory name. |

Only the newest 10 runs are kept. The source editor and the status bar read the newest report.

## Next

Build done, tests green: serve the project. [Traces](https://elide.help/docs/tern-telemetry) shows what each request did on the way to its
response.

## See also

- [`elide build`](https://elide.help/docs/cli-references#build)
- [Kotlin compiler](https://elide.help/docs/toolchain/jvm/kotlinc) and [Java compiler](https://elide.help/docs/toolchain/jvm/javac)
