croft-software 0.2.3

VSCode-style TUI written in Rust
# Layout

croft is a three pane workspace in the VS Code arrangement: an Explorer sidebar, a code editor, and a terminal, with an activity bar down the far left. This is the full pane-by-pane reference; the [README](../README.md#layout) keeps the high-level summary.

## Panes

### Left pane (sidebar)

Explorer with multi-select, cut / copy / paste, drag-and-drop moves, and VS Code style icons. Renaming or moving a file asks the language servers first, so imports that name it are updated to match (rust-analyzer, TypeScript and any server that supports `willRenameFiles`). Git-ignored files and folders render their names in dimmed grey (VS Code's ignored-resource decoration); a fully ignored folder dims along with everything under it, and the shading follows `.gitignore` edits via the same debounced refresh that feeds the status bar.

A `⋯` "Views and More Actions" button on the EXPLORER title line toggles which sub-views stack in the panel, mirroring VS Code. The toggles persist across launches (Open Editors hidden by default, the rest shown):

* **Open Editors** — the open tabs, with dirty dots and click-to-activate.
* **Folders** — the file tree.
* **Outline** — the active editor's symbol tree (functions, classes, fields), indented by nesting with kind icons. It highlights the symbol the caret is in and jumps the editor to a symbol on click. It paints instantly from tree-sitter on file open and is refined by the language server's richer symbols when they arrive, so it never waits on a cold server.
* **Timeline** — the active file's git history (`git log --follow`); clicking a commit opens its diff for that file.
* **Dependencies** — language-aware: it detects the workspace root's package manifest(s), lists their packages, and labels the header for what it found (Cargo.toml → "RUST DEPENDENCIES" from `cargo metadata`, pyproject.toml/requirements.txt → "PYTHON DEPENDENCIES", package.json → "NODE DEPENDENCIES", go.mod → "GO DEPENDENCIES"). As with rust-analyzer's view existing only in a Rust project, a folder with no recognized manifest shows no dependency view and drops it from the ⋯ menu.

Each section is individually collapsible, grows to at most half the region, and scrolls independently under the mouse wheel; the file tree absorbs the leftover rows. OUTLINE and TIMELINE start collapsed to their header chevron until expanded (matching VS Code), so they claim no rows from the tree on a fresh launch. Search and a Remote (SSH) explorer swap in via the activity bar.

### Activity bar

The icon strip down the far left: view icons (Explorer, Search, Source Control, Remote, Run and Debug, Extensions, Testing) at the top, a settings gear at the bottom.

The gear's Color Theme picker offers Croft Black (`#000000`, default), Croft Dark (Blue) (`#1e222e`), and ten editor-inspired dark themes (One Dark Pro, Dracula, Monokai, Nord, Gruvbox Dark, Tokyo Night, Catppuccin Mocha, Solarized Dark, GitHub Dark, Darcula). The choice persists in `~/.config/croft/config.json`, one layer of the settings chain — user, machine-local, and per-workspace `.croft/` files merge in order, with `extends` and platform blocks (see [SETTINGS.md](SETTINGS.md)). Themes are data: the built-ins ship as a baked-in `[[themes]]` manifest (listed in the Extensions panel as "Color Themes"), and dropping another theme manifest into `~/.config/croft/extensions/` adds it to the picker with no rebuild.

Icons carry count badges: Source Control whenever the working tree has changes, Explorer for unsaved open files, Remote for ports forwarded home over SSH, and Testing a red one for failing tests.

### Top right pane (editor)

Code editor with tree-sitter syntax highlighting, an LSP semantic-token overlay, and inline preview tabs for images, PDFs, and spreadsheets. Splits side by side with `Cmd`+`\`, with an optional native vim modal mode on `Cmd`+`E`. The usual VS Code editing commands are built in: move / copy lines, multi-cursor, toggle line and block comments, join lines, sort lines, transform case, trim trailing whitespace, and toggle word wrap.

### Bottom right pane (panel group)

A VS Code-style tab strip over a shared region; the active tab's label is underlined like VS Code's tab indicator.

* **PROBLEMS** — the aggregated workspace diagnostics view. Every file with a language-server diagnostic becomes a collapsible group (file icon, name, relative directory, and a count), and under it one row per diagnostic with a severity glyph, the message, and the source server. Finished terminal commands feed the same list through problem matchers: built-ins for rustc, tsc, gcc/clang, Python tracebacks, and eslint with zero configuration, extendable with your own regexes in `matchers.json` and honoured tasks.json `problemMatcher` declarations — watch tasks (`tsc --watch`) republish on every recompile cycle without exiting (see [MATCHERS.md](MATCHERS.md)). The tab carries an orange count badge of all diagnostics. Click a file header to collapse / expand it; click a diagnostic to open that file at the line. A toolbar filters by severity and toggles grouping by file versus a flat list. With the tab focused, typing filters the list by free text (a case-insensitive substring of the message or the file path, composing with the severity filter and shown beside the toolbar's severity chip); `Backspace` pops a character and `Esc` clears the filter before handing focus back to the editor.
* **OUTPUT** — a read-only log viewer modelled on VS Code's Output panel: a toolbar with a channel dropdown, a minimum-level filter, an RPC trace toggle, and a clear action, over the selected channel's level-coloured tail (auto-following new lines until you scroll up). Channels appear as producers log: one per language server (its `window/logMessage`, `showMessage`, and stderr), plus **Debug Adapter**, **Git** (the exact git commands the Source Control panel runs), and **Server Provisioning** (managed language-server downloads). The RPC toggle traces raw JSON-RPC per server into a `<server> (trace)` channel (Zed's RPC-messages equivalent), off by default.
* **TERMINAL** — a real interactive shell, your `$SHELL` on a real PTY, splittable into side-by-side panes.
* **CAPTURES** — output lines matched by `capture` triggers (compiler errors, test failures), each entry jumping its pane back to the line on click.
* **PORTS** — loopback ports croft detects from terminal output and a periodic socket poll. On a remote session a detected port forwards home over the live SSH connection and opens in your local browser, and Cmd/Ctrl+click on a printed `http://localhost:PORT` does the same inline.

While the PROBLEMS or OUTPUT tab is focused the arrow / page keys scroll the list and `Esc` returns focus to the editor (in PROBLEMS, once its text filter is already empty; the first `Esc` clears the filter); the mouse wheel scrolls it from anywhere.

### Secondary side bar

An optional auxiliary column on the edge *opposite* the primary side bar, hosting the active file's **Outline**. Toggle it with `Opt`+`Cmd`/`Ctrl`+`B` or from the Customize Layout popup.

All three panes resize by dragging the seams between them, including the seam between the two editor columns when the editor is split.

## Customize Layout

The `⛶` icon at the top-right of the editor (and the welcome screen), or the settings gear → **Customize Layout**, opens a popup mirroring VS Code's title-bar layout controls. Two icons beside it toggle the primary side bar (`▢`) and the panel (`▭`) directly. The popup groups:

* Visibility toggles: Activity Bar, Primary Side Bar, Secondary Side Bar, Panel, Status Bar.
* **Primary Side Bar Position** — Left/Right; the activity bar moves with it.
* **Panel Alignment** — Left/Center/Right/Justify, where Justify spans the panel across the full content width under the side bar.
* **Quick Input Position** — Top/Center, for the Command Palette / Go to File.
* **Zen Mode** (`Cmd`/`Ctrl`+`K` `Z`) — hides all chrome and restores it on the next toggle.

Every choice except the frequently-toggled side-bar / panel visibility persists in `~/.config/croft/config.json`.

## Auto-hide side bar

Off by default. When on, moving focus into the editor or a terminal collapses the primary side bar, so the panel is there while you are using it and out of the way while you are not. Focusing back into the sidebar brings it back, as does any reveal (`Cmd`/`Ctrl`+`B`, the activity bar, the Customize Layout row).

Turn it on from the Command Palette (**View: Toggle Auto-Hide Side Bar**) or the **Auto-Hide Side Bar** row in Customize Layout; the choice persists as `sidebar_auto_hide` in `~/.config/croft/config.json`. Turning it on while the sidebar is open takes effect at the next focus move rather than yanking the panel away as you enable it.

**A reveal you asked for survives the focus move that follows it.** `Cmd`/`Ctrl`+`B`, the palette command, the Customize Layout row and the layout-icon click all pin the sidebar open for exactly the next collapse, so revealing it and clicking into the editor does not immediately hide it again. Focusing the sidebar releases the pin, so the move out after that collapses normally.

The collapse is also held off whenever something else on screen depends on the sidebar staying put:

* **Focus left less than 400ms ago** - a short grace delay, so a click that passes *through* the panel on its way to the editor does not collapse it under the pointer. The clock starts when focus first leaves and is not restarted while it stays away, so the collapse cannot be pushed back indefinitely; returning focus to the sidebar cancels it.
* **A drag** - either the sidebar seam or an Explorer drag. The pointer is over the editor by definition mid-drag, and collapsing under the cursor is the flapping the feature exists to avoid.
* **Anything modal** - the keyboard-shortcuts overlay (`F1`), the Command Palette, Go to File, Go to Symbol, workspace symbols, the process picker, `Cmd`+`Z` directory jump, command history, the branch picker, an input prompt, a list picker, a context menu, or the SSH connect dialog. Several of those are sidebar-targeting flows, and some may be anchored over sidebar space.
* **A focus move you did not make** - an async result arriving, a file opened at launch, `Enter` on a sidebar row. Only a deliberate move into the editor or terminal collapses the panel.
* **A hidden activity bar** - with no activity bar there is no on-screen way back to a collapsed sidebar, so a mouse-only user would be stranded.
* **Zen Mode** - it already owns chrome visibility and keeps it.

## Command Palette

`Cmd`/`Ctrl`+`Shift`+`P` fuzzy-searches and runs every named command, the same surface VS Code uses to make actions reachable without memorising a chord. Go to Symbol (`Cmd`/`Ctrl`+`Shift`+`O`) fuzzy-jumps within a file (or to a line with a `:` prefix), and a `#` prefix in Quick Open searches symbols across the whole workspace through the language servers.

## Editor

**Viewing and navigating**

* Tree-sitter highlighting, side-by-side splits, and bracket-match highlighting.
* Inline previews for images / PDFs / spreadsheets. The rendered Markdown / notebook / document view is selectable: drag to select the text you can see, `Cmd`/`Ctrl`+`C` copies the rendered text rather than the source, `Esc` clears.
* A minimap: a rasterized file preview in a right-edge strip; click or drag to jump, right-click to toggle or re-side it.
* A breadcrumbs bar: the file path plus the enclosing symbol trail at the caret, click to jump.
* Sticky scroll: the enclosing scope headers pinned to the top while you scroll.
* Code folding: LSP fold ranges when the server provides them, with an indentation + `#region`-marker + comment-run fallback. Collapse from a gutter chevron or `Cmd`/`Ctrl`+`K` chords, including Fold All Block Comments and Fold/Unfold All Regions.
* Document links (`textDocument/documentLink`): Ctrl+click a URL, import specifier, or path the server marked as a link and croft follows it — files into the editor, web targets to the system opener, other schemes refused.

**Editing**

* Multi-cursor editing: `Cmd`/`Ctrl`+`D` for the next match, `Option`+click for a caret, `Shift`+`Option`+drag for a column selection.
* Expand/shrink selection (`Shift`+`Alt`+`→`/`←`): LSP selection ranges with a tree-sitter ancestry fallback.
* In-file find and replace: `Cmd`/`Ctrl`+`F` to find, `Cmd`+`Opt`+`F` / `Ctrl`+`Alt`+`F` to replace, with regex capture references.
* Undo and redo (`Cmd`/`Ctrl`+`Z` and `Shift`+`Cmd`/`Ctrl`+`Z`): typing bursts coalesce into one step, and a fresh edit after an undo discards the redo branch.
* Format on save, toggled with `Cmd`/`Ctrl`+`K` `F`.
* Format on type (`textDocument/onTypeFormatting` on the server's trigger characters); off by default like VS Code, toggle in Settings or the palette.
* Auto save in both VS Code modes. afterDelay: dirty buffers write themselves a second after the last edit. onFocusChange: a buffer writes itself the moment it loses focus, when the editor pane hands focus away or the active tab changes. Independent toggles in Settings and the Command Palette, so either or both can be on.
* Keyboard macros: vim `q`/`@` registers plus palette commands, a red `● REC` badge in the status bar while recording, and registers persisted to `macros.json`.
* Customizable mouse gestures: `keybindings.json` binds ctrl/alt/shift-modified clicks, middle click, right click and the wheel per region; refused rows report in OUTPUT rather than failing silently.
* An optional vim mode.

**Git in the editor**

* A git gutter: thin coloured bars marking lines added, modified, or deleted against HEAD.
* GitLens-style inline blame: a dim annotation trailing the cursor's line with the author, age, and commit summary; toggle from the Command Palette.
* Merge-conflict resolution: conflict blocks tint green / blue like VS Code and `Cmd`/`Ctrl`+`.` offers Accept Current / Incoming / Both.

**Language server features**

Completion, signature help / parameter hints, hover, go-to-definition, rename (prepare-rename validated, server placeholder pre-filled), formatting (whole document and Format Selection), quick fixes / code actions, and diagnostics, plus:

* Linked editing — editing one HTML/JSX tag renames its pair live via `textDocument/linkedEditingRange`.
* Color swatches (`textDocument/documentColor`): a `■` in the value's color spliced before `#rrggbb`/`rgb()` literals, with a "Change Color Presentation" picker to rewrite the spelling.
* Inlay hints — inferred types and parameter names spliced inline as dim italic annotations, on by default like VS Code; toggle with **Editor: Toggle Inlay Hints**.

Markdown source is coloured in the editor itself, on the theme's own roles: headings, list and task markers, quotes, bold / italic / strikethrough, inline code, links, table headers, and fenced code blocks and front matter in their own language's colours. It also gets a rendered preview on `Cmd`/`Ctrl`+`Shift`+`V` (VS Code's chord): headings, emphasis, lists, task checkboxes, quotes, aligned tables, links, and fenced code blocks coloured by the editor's own tree-sitter highlighters, reflowing with the pane and following your edits.

Make it yours: rebind any command in `keybindings.json`, define `Tab`-expandable snippets (with tab stops and placeholders) in `snippets.json`, and flip settings from a searchable **Preferences: Open Settings** hub — all under `~/.config/croft/` and reachable from the Command Palette.

## Terminal

The TERMINAL tab is your `$SHELL` on a real PTY, splittable into side-by-side panes.

* **Shell integration:** OSC 133 auto-installs for zsh, bash 4.4+, and fish, so `Cmd`/`Ctrl`+`Opt`+`Up`/`Down` jumps between command prompts. Every finished command gets a VS Code-style gutter dot on the pane border (blue for success, red for failure); click it for the exit code, runtime, and a menu to copy or select that command's output or re-run it. Long commands finishing in an unfocused pane announce themselves, new splits inherit the shell's exact cwd, and OSC 9 notifications surface in the status bar.
* **Find:** `Cmd`/`Ctrl`+`F` searches the pane's screen and scrollback with every hit highlighted.
* **Quick select:** `Ctrl+Shift+Space` opens WezTerm-style quick select, labelling every URL, path, hash, and IP on screen so two keystrokes copy one (UPPERCASE pastes it into the shell).
* **Copy mode:** `Ctrl+Shift+Y` enters copy mode, where vi keys walk the scrollback and `v`/`V`/`Ctrl+V` select by character, line, or rectangular block before `y` copies.
* **Command history:** `Ctrl+Shift+H` searches every command run under croft, kept across restarts with its directory, exit code, and duration. Filter to the current directory or failures only; `Enter` types the pick back at your prompt.
* **Triggers:** iTerm2-style triggers from `triggers.json` watch the output stream and highlight matches in your colours, post status-bar notices, or capture matching lines into the CAPTURES tab, where one click jumps back to the line.
* **Agent lanes:** a pane whose foreground process is a coding agent (claude, codex, aider, gemini, or a row from `agents.json`) wears `◆ claude` in its name pill with a status glyph — `●` working, `◐` waiting for you, `○` idle — and the status bar shows `◆ 2 agents · 1 waiting` while any is seated; clicking it reveals the waiting pane. A worktree lane's root row in the Explorer wears the lane's branch and that same badge after the folder name (`repo-fix-login  agent/fix-login · ◆ claude ●`), the configured agent's bare name before it is seated, or the branch alone for a plain-shell lane. "Agents: Show Changed Files" groups the review queue by root, so a lane's changes read as their own section named by its branch
* **Ask about a capture:** in CAPTURES, `n` on a row asks the resident Navigator about that line with the pane rows around it
* **Broadcast:** `Cmd`/`Ctrl`+`K` `I` broadcasts your typing to every pane at once for multi-server work, behind a confirm popup and with red `⇶` pills marking the receiving panes.
* **Inline images:** `imgcat` pictures render inline at their output row.
* **Progress:** a program reporting OSC `9;4` progress (systemd, winget, cargo wrappers) turns the pane's bottom border into a live gauge — blue advancing, red frozen on error, yellow paused, a sweeping segment while indeterminate — with the percent echoed in the pane's name pill.
* **Scrollback:** `Shift+PageUp`/`PageDown` page the scrollback (depth configurable), scrolling deep into output pins the producing command to the pane's top row, a palette toggle shows each row's arrival time down the right edge, and clicking the prompt line moves the shell cursor there. `Cmd`/`Ctrl`+`K` `D` opens the pane's whole scrollback in an editor tab, and `Cmd`/`Ctrl`+`K` `N` pins a note to selected output (amber-underlined, click to read).
* **Panes:** pane colors follow the theme's own ANSI palette, so output looks identical in every host terminal. Drag a pane's name pill to reorder panes; a `⛶` button or `Cmd`/`Ctrl`+`K` `M` maximizes one pane across the panel while the rest wait in a right-edge rail you can shuffle through or drag into a new order. A closed pane stays undoable for 10s (`Cmd`/`Ctrl`+`K` `Shift+T` brings it back, process intact), and the whole pane layout — directories, names, focus — is saved per workspace and restored on the next launch. `host_accents` rules in config.json dress panes on matching hosts: production shells get a red border, warning pill, and badge watermark.
* **Selections:** selections stay glued to their text through streaming output, through your scrolling, and even inside full-screen apps that scroll by repainting (Claude Code, pagers). There the highlight follows the app's own scrolling, keeps its surviving rows lit while the app's chrome covers the block's edge, hides only when the text is fully off the app's view (copy still yields the whole selection), and comes back with it. `Shift`+click extends a selection, and a drag held past the pane edge keeps selecting — through scrollback at a shell, or by scrolling the app itself when it owns the wheel.
* **Jump to source:** Cmd/Ctrl+click on any printed `path:line` reference (a compiler error, test failure, grep hit, or traceback) jumps the editor straight there, with no problem-matcher config. The Command Palette's **Terminal: Search & Replace from Last grep/rg** turns the `grep`/`rg` you just ran in a pane into the Search sidebar's results, ready to replace across every match.


**Command suggestions.** As you type at a prompt, the rest of the newest matching command from croft's history appears after the cursor in grey (preferring one that succeeded in the same folder); `Right` at the end of the line accepts it, as in fish. A shell that draws its own suggestions (fish, zsh-autosuggestions) is left alone, and **Terminal: Toggle Command Suggestions** turns croft's off.
## Source Control

Source Control mirrors VS Code's git flow: stage, unstage, and discard per file or in bulk, commit / amend / push / pull / sync, branches, stashes, and tags, with clickable change rows opening a side-by-side diff against HEAD.

Inside that diff, single keys act on the change hunk under the cursor: `S` stages just that hunk, `U` unstages it, and `R` reverts it after a confirm. Drag a selection across rows first and `S`/`U` narrow to exactly those lines (VS Code's Stage Selected Ranges), leaving the rest of the hunk untouched in the index — so one messy working tree becomes several focused commits without leaving the editor.

Below the change list, a **COMMITS** section draws the repo-wide commit graph (VS Code's built-in Source Control Graph, in the tig / lazygit idiom): colour-cycled box-drawing rails trace every branch and merge across local branches and tags, each row showing its ref badges (HEAD's branch bold, tags gold), subject, and age. Clicking a commit opens its full patch — header, message, diffstat, diff — in a read-only editor tab, and the graph refreshes itself whenever HEAD moves.

## Pull request review

`croft pr 123` (or a PR URL), or **Source Control: Review Pull Request** with a picker over the open PRs, opens a **PULL REQUEST** tab. It lists every changed file with `+n −m`, then the checks, under a `3 of 12 viewed · 10 passed · 1 failed` summary. `Space` marks a file viewed, and the mark persists. `Enter` opens a file's diff, or a check's log. `l` opens the failing check's log, and `r` refreshes; pending checks also refresh on their own. `c` checks the PR's head out into a worktree beside the repository (`<repo>-pr-123`) and adds it to the workspace, so the changed code has the language server, go-to-definition and tests. Pressing `c` again after a new push moves the checkout. `Esc` leaves review and removes the checkout. A checkout with edits, build output or new commits in it is kept, and the status says why.

**Review: Load PR Comments for This File** shows the branch's PR threads as boxes under their lines, with replies folded into their thread. Type a reply into a box's field and it posts to GitHub. **Review: Resolve or Unresolve Thread** acts on the focused box, or the next one. **Review: Add Comment on This Line** adds a pending comment, shown as a box, and **Review: Submit Review** sends the pending comments as Comment, Approve or Request Changes with a summary. Comments on lines outside the diff go into the summary. **Review: Discard Pending Comments** drops them.

**Source Control: Export Comments to Pull Request** posts the navigator's notes, together with your pending comments, as one review on the branch's PR. It shows a preview first, listing each comment and how many go inline versus into the summary. The navigator's comments start with `[AI, croft navigator] ` (set `review_ai_prefix` to change it, or `""` to drop it). Once posted, they leave the editor and come back as the PR's threads.

## Interactive rebase

`git rebase -i` run in a croft terminal opens its plan (`git-rebase-todo`) as a croft tab, because croft points `GIT_SEQUENCE_EDITOR` at `croft edit --wait` in every pane it spawns (a sequence editor you set yourself always wins). In that tab a single key sets the caret commit's action: `p` pick, `r` reword, `e` edit, `s` squash, `f` fixup, `d` drop (with vim mode on, those keys stay vim's). `Alt`+`Up` / `Down` reorder commits. Save and close the tab and git carries on; **Rebase: Abort** in the palette empties the plan, which makes git abort. `croft edit --wait <file>` works for any tool that wants an editor it can wait on.

## Local history

croft snapshots each file as you save it, and the Explorer's TIMELINE lists those snapshots next to the git commits (VS Code's Timeline model). Diff any past version against the working file or restore it — including versions you never committed.

## Testing

A **Testing** view (the beaker icon, or `Cmd`/`Ctrl`+`K` `B`) mirrors VS Code's Test Explorer. It discovers the project's tests on first open — `cargo test` for Rust, `pytest` for Python, `vitest` or `jest` for JS/TS (detected from package.json), `go test` for a Go module — and lists them as a suite tree with live pass/fail/skip glyphs. Each runner is a built-in extension, so switching one off in the Extensions panel stops its projects being detected.

Each row's play glyph runs that test or suite (a green ▷ also marks test functions in the editor gutter, click it to run), clicking a test's name jumps to its source, Enter runs everything, and `Cmd`/`Ctrl`+`K` `Enter` runs the test under the editor caret. The beaker icon wears a red badge counting failures.

**Coverage.** "Testing: Run All Tests with Coverage", or the bar-chart glyph in the TESTING header, runs everything with the runner's coverage tool. The same glyph on a suite or test row, just left of its eye, runs only that suite or test with coverage. Once a report covers a suite's own file, the suite's row shows that file's line percentage before the glyph: the file itself for a pytest or JS suite, and for a cargo suite the module's file (`parse::tests` is `src/parse.rs`, or `src/parse/mod.rs`). The tools are pytest-cov, `@vitest/coverage-v8`, jest's built-in coverage, `cargo llvm-cov` for Rust, or `go test -coverprofile` for Go. Each writes LCOV (croft converts Go's profile), which croft reads into one model. The editor's change-bar lane then shows each executable line of a covered file: green ran, red never ran, and a short amber mark means the line ran but one of its branches never did. Once the file is edited or rewritten after the run, the marks dim so they aren't trusted for code that moved. The Ln/Col readout in the status bar adds the file's line percentage. "Coverage: Clear" drops the report and gives the lane back to git. If the tool isn't installed, croft says which one and "Testing: Install Coverage Tool" runs the install in a terminal pane: `cargo install cargo-llvm-cov`, `uv add --dev pytest-cov` (or pip), or the project's npm/pnpm/yarn for vitest.

**Watch mode.** Each row ends in an eye: click it to watch that test or suite, and the eye in the TESTING header (or `w`, or "Testing: Toggle Watch All Tests") watches everything. While a watch is on, saving any file under the runner's root reruns the watched scope about 300 ms later, except a file git ignores (build output, a `.env`). A burst of saves reruns once, and a save made while another run is going waits for it. A rerun leaves the sidebar where it is. A watched run that turns red (from green or from never having run) raises the beaker's badge and names the failing test in the status line; "Testing: Go to First Failure" jumps to its source. A run that stays red or goes green says nothing. One scope is watched at a time: clicking another eye moves the watch, and clicking the lit one turns it off.

## Live Run

![Live Run: values, output, errors and coverage painted beside the code as you type](images/live-run.gif)

`Cmd`/`Ctrl`+`K` `V` (or **Python: Toggle Live Run** in the palette) turns a Python file into a live notebook without cells. Every time you pause typing, croft runs the buffer, unsaved edits included, and paints what each line did beside it:

```text
def fib(n):  n = 10
    for i in range(n):  i = 0, 1, 2 … 9 ×10
        a, b = b, a + b  a = 1, 1, 2 … 55 ×10  b = 1, 2, 3 … 89 ×10
    return a  ↩ 55
squares.append(k * k)  squares = [0], [0, 1], [0, 1, 4] … [0, 1, 4, 9, 16] ×5
print("total is", total)  ▸ total is 30
fib(10)  → 55
ratio = total / (len(squares) - 5)  ✖ ZeroDivisionError: division by zero
```

* **Values**: what each assignment, loop variable, parameter, and in-place method call (`items.append(x)`) left behind. A line that runs many times shows the first values it took, then the last, then how many times it ran. Objects without their own `__repr__` show their fields (`Point(x=3, y=4)`).
* **Output and results**: what a line printed (`▸`), what a `return` returned (`↩`), and the value of a bare expression (`→`), so a trailing `fib(10)` works like a REPL.
* **Failures**: the exception lands on the line that raised it, in red. A run that goes past 3 seconds is interrupted and the line it was stuck on says so, in amber.
* **Coverage**: line numbers go green for statements that ran and a muted red for statements that never did, so a branch you thought was taken shows up at a glance.

The run uses the file's own directory as its working directory and `sys.path[0]`, with the nearest `.venv` / `venv` / `.env` interpreter inside the workspace (falling back to `python3`), so imports and relative paths behave as they would from a terminal. stdin is empty and nothing is written to `__pycache__`. Only a line whose text still matches the run shows a value, so an edited line goes bare until the next run lands rather than showing a stale answer. A stopped debugger's inline values take precedence over Live Run's on the same line.

Live Run executes your code on every pause, so it is armed **per file**: toggling it on for one script never runs another, and nothing runs until you ask.

## Tasks

Zero configuration: `Cmd`/`Ctrl`+`Shift`+`B` runs the project's build task, auto-detected from the manifests the repo already has (Makefile, justfile, package.json with the right lockfile runner, Cargo.toml, pyproject.toml, and `.vscode/tasks.json` when present). "Tasks: Run Task" in the palette lists everything discovered; each task runs in its own named terminal pane, and rerunning reuses that pane.

## Status bar

The status bar mirrors VS Code's: branch and ahead/behind, error/warning counts (click to open Problems) and the active language server on the left; cursor position, indentation, encoding, line ending, and language mode on the right.

Click a segment to change it. The indentation pill opens VS Code's Select Indentation menu (Indent Using Spaces / Tabs, change the tab size, or convert the buffer's existing indentation); the rest reopen with a different encoding, switch LF/CRLF, or override the language mode.

## Debugging

* **Debug Python with breakpoints:** set breakpoints in the editor gutter (`F9`) and press `F5`; croft launches the file under debugpy over the Debug Adapter Protocol so it stops on the red lines. Step over (`F10`), step into (`F11`), step out (`Shift+F11`), resume (`F5`), pause a running program (`F6`), stop (`Shift+F5`). When paused, the Run and Debug panel shows the call stack and an expandable variables tree, plus a debug console of program output with a `❯` REPL that evaluates in the selected frame; hovering a variable in the editor shows its value. Conditional breakpoints (a red `◆`) and break-on-exceptions are in the Command Palette; breakpoints the adapter can't bind show hollow (`○`). Requires CPython 3.14+ (croft provisions a private debugpy venv on first use); no fallback to older interpreters. Rust / C / C++ files route to `lldb-dap` through the same machinery. Go files route to delve (`dlv`). Without it, "Debug: Install Go Debugger (delve)" runs `go install` in a terminal pane, into `~/.croft/servers/go`, and says so if Go itself is missing. It installs a delve that works with your Go: delve 1.25.2 for Go 1.24 and older (newer delve refuses them), the latest otherwise. If the debugger refuses to start the program anyway, the session ends with its reason in the status line and the debug console.
* **More breakpoint kinds:** "Debug: Add Hit Count Breakpoint" pauses only once a line has been hit N times; "Debug: Add Function Breakpoint" pauses on entry to a named function (kept for every later session too); "Debug: Break When Value Changes" pauses when a variable of the paused frame is written (adapters with data breakpoints, such as lldb-dap); and `Ctrl+F10` runs to the caret line and stops there once without leaving a breakpoint behind. Kinds an adapter does not support say so instead of silently doing nothing.
* **Debug configurations (`launch.json`):** croft reads `.vscode/launch.json` (JSONC, unchanged from VS Code) and `.croft/launch.json` (same schema, no `.vscode/` required) — program arguments, `env`/`envFile`, `cwd`, `stopOnEntry`, a `preLaunchTask` resolved against the task registry (runs in its terminal pane, gates the launch on exit 0), attach by `port` (node, python) or `processId` (lldb), `${...}` variable substitution with loud errors for unresolvable variables, and verbatim passthrough of adapter-specific fields. "Debug: Select and Start Debugging" (or the config row in the Run and Debug panel) picks what `F5` launches; the zero-config "Debug active file" entry is always there. "Debug: Add Configuration…" builds a new entry one prompt per field and adds it to `.croft/launch.json`.

  Compounds declared in the same file are listed too, with their member configurations. Selecting one that names a SINGLE configuration launches it — that needs one session, which croft runs. One that names several is refused rather than launched as a subset, since debugging only the members that happen to resolve would debug something other than what was asked for; running several sessions at once is [still to build](https://github.com/vitali87/croft/issues/310). `presentation.hidden` keeps a compound out of that picker entirely, and one asking only to be hidden launches normally; `presentation.group` and `presentation.order` want an ordering the picker does not have, so a single-member compound setting either is refused rather than launched without it ([#318](https://github.com/vitali87/croft/issues/318)). A compound's own `preLaunchTask` runs before its member starts, gating the launch on exit 0 exactly as a configuration's own task does, and chains with the member's if it has one.
* **Or attach to a running Python process:** the Command Palette's "Debug: Attach to Python Process" lists live CPython 3.14+ processes and drops a `pdb` REPL into the one you pick (PEP 768 `sys.remote_exec`, no restart, no instrumentation). Because croft owns a real PTY, the debugger and any `sudo` password prompt run right in a terminal pane, instead of the half-managed console a GUI editor falls back to.

## Language servers

The editor speaks LSP for completion, hover, go-to-definition / references / implementations, rename, document formatting (`Cmd`+`Opt`+`Shift`+`F`), quick fixes / code actions (`Cmd`+`.`: auto-import, fix-all, organize imports, and refactors, picked from a menu and applied as one undo step, with `codeAction/resolve` for servers that defer the edit), and diagnostics. Each is anchored at the file's own project root, so monorepo sub-projects resolve correctly.

Which server runs per language:

| Language | Server |
|---|---|
| Python | Astral's `ty` as the primary, `basedpyright` as a fallback for the few capabilities `ty` does not yet advertise, and `ruff` for lint |
| TypeScript / JavaScript | `vtsls` |
| YAML | `yaml-language-server` |
| JSON / HTML / CSS | the VS Code servers (`vscode-json-language-server`, `vscode-html-language-server`, `vscode-css-language-server`) |
| Bash | `bash-language-server` |
| TOML | `taplo` |
| C / C++ | `clangd` |
| Markdown | `marksman` (link and heading completion, go-to-definition across files, references, heading rename, broken-link diagnostics, OUTLINE symbols), alongside croft's built-in Markdown lint |

croft provisions `vtsls`, `yaml-language-server`, the JSON / HTML / CSS servers, and `bash-language-server` (via npm) and `ty` / `ruff` (via uv, or `pkg` on Termux) for itself on first use. `taplo`, `clangd`, `rust-analyzer`, and `marksman` ship as prebuilt binaries, so croft downloads the right release for your platform into `~/.croft/servers` — a toolchain copy on PATH or in `~/.cargo/bin` always wins, and on Termux `rust-analyzer` and `marksman` come from `pkg` since the glibc releases can't run on bionic. marksman's download is checked against a SHA-256 pinned in croft and refused if it does not match. It also picks up `basedpyright` and `gopls` from your PATH if present.