A1: tab management: preview tabs, pinning, close actions, reopen closed tab, split into two groups
- Pure tab model (components/editor/tabs/model.ts) with Vitest coverage. - Editor store keeps one buffer sync per buffer and a group layout; a buffer in both groups shares text and undo. Bulk closes ask once with a list. - Tab context menu, tabs.* UI commands (COMMAND_IDS) in a Window menu group, no default shortcuts; Show Local History appears once history.show exists. - Single click in the tree, Find and Go-to opens preview tabs. - Layout stored through layout.set and restored on project open. - Public API for other areas: tabOfPath, tabOf, reloadBuffer, openFile. - Docs: ui-parity, gaps (G2), architecture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
02922eb89d
commit
7f309dbc4e
28 changed files with 3003 additions and 211 deletions
|
|
@ -140,6 +140,16 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
- Closing a dirty tab asks Save / Don't Save / Cancel; `buffer.close` without `force` failing with `unsaved_changes` also leads to the question. Since M3.10 changes are also saved automatically (see Autosave).
|
||||
- Theme: the editor reads colours only from `--lt-*` tokens, including the editor tokens from M1.10 (selection, active line, cursor, gutter, match, editor font size); no fallbacks remain.
|
||||
|
||||
### Tab management (C10 A1)
|
||||
|
||||
- **Model:** `ui/src/components/editor/tabs/model.ts`, pure functions on a `TabLayout` (one or two groups, each with its tab placements `{id, pinned, preview}` and active buffer; the focused group; the orientation `right|down`). Rules: one preview per group, replaced in place by the next preview (the replaced buffer is closed unless the other group shows it); pinned tabs first and left out of bulk closes; an emptied group goes away while another is left; at most two groups.
|
||||
- **Store:** `ui/src/stores/editor.ts` keeps one record and one `BufferSync` per buffer and the layout; `tabs` lists every open buffer once, `activeId` is the focused group's active buffer, `groups` feeds the panes. A buffer in both groups has one sync, which now updates every attached view (`BufferSync.attach/detach(view)`), so both groups share text, selection and undo history. Closing a tab the other group still shows only removes the tab; bulk closes ask once (`closePrompt.items`) with Save All / Don't Save / Cancel. "Reopen Closed Tab" keeps the last 30 non-preview closes per window with group, index, pin, selection and the position at the top of the view.
|
||||
- **Public API for other areas:** `tabOfPath(path)`, `tabOf(id)`, `reloadBuffer(id)` (the sync takes the engine's text over and drops unsent edits, after the engine reloaded a file), `openFile(path, {preview?, group?, activate?, pinned?, index?})`. Banners about a group's active tab go into `EditorPane.vue`.
|
||||
- **Opening:** the project tree's single click, Find results and Go-to choices open previews (`editor.reveal` takes `preview: true`); double click, Enter and every other caller open permanent tabs. Setting `editor.tabs.preview` (bool, default true) turns previews off.
|
||||
- **Commands:** UI commands `tabs.closeOthers|closeAll|closeLeft|closeRight|closeUnmodified|reopenClosed|togglePin|keepOpen|splitRight|splitDown|moveToOtherGroup|focusOtherGroup|unsplit` (`tabs/commands.ts`, `COMMAND_IDS`, spread into `UI_COMMANDS`), params `{id?, group?}`, menu group Window; no default shortcuts. The tab context menu (`tabs/TabContextMenu.vue`) runs them.
|
||||
- **Persistence:** `layout.get` → `{layout: object|null}` and `layout.set {layout}` (engine, `cmd/layout.rs`) keep the layout of the open project in `<data_dir>/layout/<project-id>.json` (project id as in the recovery journal; written with `write_atomic`; 256 KiB cap both ways; a missing or broken file reads as null). The store writes 300 ms after a change, restores on `projectOpened` (files that are gone are skipped) and never writes while a project closes. Never in webview storage (ESLint rule).
|
||||
- **Not yet:** drag to reorder or between groups, diff tabs outside the first group, separate selections per group for the same file.
|
||||
|
||||
### Highlighting and editor.reveal (M2.2)
|
||||
|
||||
- **Languages:** `ui/src/components/editor/language.ts` picks a language once per tab from the file extension (`languageOf`): PHP (`php`, `phtml`, `inc`, `php3`–`php8`, `phps`) through `@codemirror/lang-php`, whose Lezer grammar also parses the HTML, CSS and JavaScript around `<?php … ?>` blocks; HTML, CSS, JavaScript/TypeScript (with JSX), JSON, YAML and Markdown through their `@codemirror/lang-*` packages (all MIT). Other files stay plain text. The editor store passes the tab's path to `editorExtensions(path)` when it creates the tab's state.
|
||||
|
|
@ -170,7 +180,7 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
|
||||
- `<config_dir>/settings.json`, a flat JSON object of dotted keys, written with `lutra_vfs::write_atomic` on every change. Unknown keys are kept; a stored value that fails validation counts as unset. Read with a 1 MiB cap.
|
||||
- A file that is not a JSON object (invalid JSON, not UTF-8, too large) is renamed to `settings.json.bad-<YYYYMMDDTHHMMSSZ>` (with `-n` if taken), the defaults are used and a `notification {level: "warning", messageKey: "notification.settings.corrupt", message, params: {reason, backup}}` is queued. If it cannot be moved, or the directory or file cannot be read, settings stay in memory for the session (`notification.settings.corruptNotMoved`, `notification.settings.unavailable`) so the file is never overwritten.
|
||||
- Keys: `appearance.theme` (`lutra-dark|lutra-light|system`, default `system`), `editor.fontSize` (int 8–48, default 14), `ui.language` (`en`), the autosave keys `editor.autosave.onBlur`, `editor.autosave.onTabSwitch` (bool, default true) and `editor.autosave.idleSeconds` (int 0–600, default 15; M3.10), the assist keys `editor.completion.autoPopup` (bool, default true), `editor.completion.delayMs` (int 0–2000, default 0) and `editor.hover.delayMs` (int 100–3000, default 350; H4). Defined in `lutra_engine::settings::DEFS`.
|
||||
- Keys: `appearance.theme` (`lutra-dark|lutra-light|system`, default `system`), `editor.fontSize` (int 8–48, default 14), `ui.language` (`en`), the autosave keys `editor.autosave.onBlur`, `editor.autosave.onTabSwitch` (bool, default true) and `editor.autosave.idleSeconds` (int 0–600, default 15; M3.10), the assist keys `editor.completion.autoPopup` (bool, default true), `editor.completion.delayMs` (int 0–2000, default 0) and `editor.hover.delayMs` (int 100–3000, default 350; H4), `editor.tabs.preview` (bool, default true; C10 A1). Defined in `lutra_engine::settings::DEFS`.
|
||||
- Commands: `settings.list` → `[{key, type: enum|int|bool|string, default, enumValues?, min?, max?, path?, labelKey, descriptionKey, section}]` (`path: true` marks a file path setting, `Kind::Path`) (catalog keys `settings.<key>.label` / `.description`; `section` is an id shown with `settings.section.<id>`), `settings.get {keys?}` → `{values}`, `settings.set {key, value}` → `{value}`, `settings.reset {key}` → `{value}`. Unknown keys and bad values fail with `invalid_params`; a write failure fails with `failed` and changes nothing.
|
||||
- Events: `settingsChanged {keys}` when an effective value changes; `notification {id, level: info|warning|error, messageKey?, message?, params?}` (ids `n1`, `n2`…).
|
||||
|
||||
|
|
@ -789,6 +799,7 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-08 | minor | C10 A1: tab management, editor groups, `layout.get/set` |
|
||||
| 2026-11-06 | minor | C9 D2: remote browser, compare and sync; save before upload |
|
||||
| 2026-11-06 | minor | C9 D1: `crates/deploy` (L3), `deploy.*` commands, deployment events and UI |
|
||||
| 2026-11-02 | minor | C9 F1: `Kind::Path` and `check_path` (one validator for `settings.set` and the dialog, `path` in `settings.list`), `lutra_proc::spawn_detached` for the CLI's desktop start |
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Every known shortfall, ranked. This is the work list: unless the owner gives a t
|
|||
| # | Gap | Milestone | Estimate (one agent) |
|
||||
|---|---|---|---|
|
||||
| G1 | ~~Foundation: workspace, quality gate, command registry, guard, control channel~~ closed 2026-10-14 | M0 | done (~2 h measured) |
|
||||
| G2 | Editor core: ~~engine buffers, save~~ (M1.3), ~~editor UI with tabs, undo, multi-caret~~ (M1.6, CodeMirror basics), ~~recovery journal~~ (M1.7), tab management (preview, pin, split, close others, reopen), conflict UI for files changed on disk, ~~autosave~~ (M3.10), local history | M1 | ~14 h |
|
||||
| G2 | Editor core: ~~engine buffers, save~~ (M1.3), ~~editor UI with tabs, undo, multi-caret~~ (M1.6, CodeMirror basics), ~~recovery journal~~ (M1.7), ~~tab management (preview, pin, split, close others, reopen)~~ (C10 A1), conflict UI for files changed on disk, ~~autosave~~ (M3.10), local history | M1 | ~10 h |
|
||||
| G3 | Project model: ~~VFS~~ (M1.2: listing, ignore rules, native file watching with polling fallback, safe file IO), ~~project tree wiring~~ (M1.5 UI, M1.3 engine, M1.4 bridge: folder picker, live tree), tree toolbar and options, ~~showing truncated listings~~ (M1.13), ~~error notifications for the folder picker~~ (M1.12), ~~tabs~~ (M1.6), ~~command palette~~ (M1.8: commands only, global keymap, UI commands over the control channel); ~~settings~~ (backend: M1.9a; dialog with search: M1.9b; string and path controls: H4), ~~theme switching~~ (M1.10: light/dark, live, system mode; picker in the dialog, M1.9b; C9 T1: six built-in themes, picker with live preview, theme file import, editor font family and line height), ~~main menu~~ (M3.9: hamburger dropdown from `menuPath`s; native macOS menu bar: A1 adds the system menus (Lutra, Edit, Window; ⌘W and ⌘Q stay Lutra's), mirroring Lutra's own menus natively and display modes open) | M1 | ~24 h |
|
||||
| G4 | Syntax and structure: tree-sitter PHP, ~~Lezer highlighting~~ (M2.2: PHP with embedded HTML plus HTML, CSS, JS/TS, JSON, YAML, Markdown; `--lt-syntax-*` tokens; `editor.reveal`), ~~file structure~~ (M2.7: Structure tool window, `syntax.outline`), semantic highlighting, folding in the editor | M2 | ~8 h |
|
||||
| G5 | Search and navigation: find in files, go to file/class/symbol, first index | M2 | ~35 h |
|
||||
|
|
@ -28,7 +28,7 @@ Every known shortfall, ranked. This is the work list: unless the owner gives a t
|
|||
| G20 | AI features (chat, inline prompts, commit messages); MCP server is G7/M3 | M9 | ~60 h |
|
||||
| G21 | Feature breadth: the full PhpStorm help inventory has 155 feature units; ~23 have at least partial support (2026-10-18, estimated). The list lives in `plan/phpstorm/00-feature-inventory.md` with public URLs | ongoing | — |
|
||||
|
||||
G2 progress: the engine text buffer landed (M1.1, `crates/text`: rope, UTF-16 and char positions, atomic edit batches, line ending policy). M1.3 added engine buffers with versions, the edit protocol, save and save all, and reloading on external changes. M1.6 added tabs and a CodeMirror 6 editor synced to engine buffers (version-based edits with resync, CRLF-aware offsets), save and save all by engine shortcuts, the Save / Don't Save / Cancel question and a notice for files changed on disk. M1.7 added the crash-recovery journal (debounced atomic entries per dirty buffer, `recovery.*` commands, restore dialog; not yet checked in the running app). M1.13 made re-opening an open file switch to its tab and keeps the folders of open files watched. M3.10 added autosave (window blur, tab switch, after 15 s idle; settings) and `flushDirty()`, the one "save all dirty and wait" entry point for later deployment and run features; autosave skips files in conflict with the disk. Still open: tab management beyond open/close, a conflict UI (compare and merge with the disk version), local history, editor settings (soft wrap); estimate lowered to ~14 h.
|
||||
G2 progress: the engine text buffer landed (M1.1, `crates/text`: rope, UTF-16 and char positions, atomic edit batches, line ending policy). M1.3 added engine buffers with versions, the edit protocol, save and save all, and reloading on external changes. M1.6 added tabs and a CodeMirror 6 editor synced to engine buffers (version-based edits with resync, CRLF-aware offsets), save and save all by engine shortcuts, the Save / Don't Save / Cancel question and a notice for files changed on disk. M1.7 added the crash-recovery journal (debounced atomic entries per dirty buffer, `recovery.*` commands, restore dialog; not yet checked in the running app). M1.13 made re-opening an open file switch to its tab and keeps the folders of open files watched. M3.10 added autosave (window blur, tab switch, after 15 s idle; settings) and `flushDirty()`, the one "save all dirty and wait" entry point for later deployment and run features; autosave skips files in conflict with the disk. C10 A1 added tab management: preview tabs (and their setting), pinning, close others/all/left/right/unmodified with one question for every unsaved file, reopen closed tab with selection and scroll, a second editor group (split right/down, move, focus, unsplit) sharing one engine buffer and undo history, a tab context menu, `tabs.*` commands and the tab layout per project in Lutra's own state file. Left from tab management: drag to reorder or between groups, more than two groups, a tab limit, a recent-files switcher. Still open: a conflict UI (compare and merge with the disk version), local history, editor settings (soft wrap); estimate lowered to ~10 h.
|
||||
|
||||
G4 progress: M2.1 added the structural half in `crates/syntax`: tree-sitter PHP parse and incremental reparse, outline (namespaces, class-likes, functions, members, promoted properties, enum cases; anonymous classes marked) and folding ranges, an 8 MiB parse cap, proptests and snapshots. M2.2 made highlighting visible. M2.7 added the Structure tool window: each open PHP buffer keeps a tree-sitter tree, reparsed incrementally on a worker thread off the engine lock (200 ms debounce), `syntax.outline` and `outlineChanged`, and the outline as a tree in the left tool window with jumps through `editor.reveal`. Open in G4: semantic highlighting, folding in the editor, Structure speed search, sorting and filters. Finding: a full parse of 1 MB takes 364–553 ms on the dev machine (target 50 ms; reparse 7–11 ms), so parsing must stay off the engine lock and the index must parse in parallel.
|
||||
|
||||
|
|
@ -55,6 +55,7 @@ G6 progress: M3.2 landed the LSP client library in `crates/lsp`: JSON-RPC framin
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-08 | minor | G2 shrunk: tab management (C10 A1) |
|
||||
| 2026-11-06 | patch | G17: deployment v2 (C9 D2): remote browser, compare, sync |
|
||||
| 2026-11-06 | patch | G17: deployment v1 (C9 D1); remote browser, compare and sync left for D2 |
|
||||
| 2026-11-06 | minor | G3: more themes, theme import, editor font settings (C9 T1) |
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
- M1.5 (2026-10-14): tree of the open folder with lazy `project.children` listings, folders and PHP files with Lucide icons, ignored/excluded entries dimmed, keyboard navigation (WAI-ARIA tree: arrows, Home/End, Enter), double-click opens, refresh on `TreeChanged`, listing errors shown in the tree, empty state with Open Folder…. Vitest only, against a mocked engine.
|
||||
- M1.4 (2026-10-15): runs against the real engine in the app: projects open from the folder picker or the command line, the tree updates live when files change on disk; checked with `ui.screenshot` on Windows 11. M1.13 (2026-10-16): a partly listed folder ends with a "Listing truncated" note; opening a file that is already open (tree, control channel) switches to its tab (Vitest; live check pending (gaming mode)). Missing: scroll from source (Select Opened File), expand/collapse all, views list, sort options, speed search, file colours, file operations. Behaviour notes: `plan/phpstorm/02-project-view.md`.
|
||||
- [ ] Editor tabs (pin, split, reorder, close others)
|
||||
- M1.6 (2026-10-15): tab bar above a CodeMirror 6 editor; files open from the project tree (Enter, double click) next to the active tab, or from engine events (control channel, page reload); click and Left/Right activate, the close button, a middle click and `Mod+W` close; a dot marks unsaved changes; closing a dirty tab asks Save / Don't Save / Cancel; `Mod+S` saves, `Mod+Alt+S` saves all (shortcuts read from the engine's command specs); a non-blocking notice when a dirty file changes or disappears on disk. Checked with `ui.screenshot` on Windows 11 and Vitest. Missing: preview tab, pin, split, reorder by drag, close others/all, reopen closed tab, tab limit, tab context menu, recent-files switcher, duplicate-name disambiguation. Behaviour notes: `plan/phpstorm/03-editor-tabs.md`.
|
||||
- M1.6 (2026-10-15): tab bar above a CodeMirror 6 editor; files open from the project tree (Enter, double click) next to the active tab, or from engine events (control channel, page reload); click and Left/Right activate, the close button, a middle click and `Mod+W` close; a dot marks unsaved changes; closing a dirty tab asks Save / Don't Save / Cancel; `Mod+S` saves, `Mod+Alt+S` saves all (shortcuts read from the engine's command specs); a non-blocking notice when a dirty file changes or disappears on disk. Checked with `ui.screenshot` on Windows 11 and Vitest. Missing (then): preview tab, pin, split, reorder by drag, close others/all, reopen closed tab, tab limit, tab context menu, recent-files switcher, duplicate-name disambiguation. Behaviour notes: `plan/phpstorm/03-editor-tabs.md`.
|
||||
- C10 A1 (2026-11-08): **preview tabs**: a single click in the project tree, a Find result or a Go-to choice opens a preview tab (italic title) that the next preview in its group replaces; editing it, opening it for good (double click in the tree), a double click on the tab or "Keep Tab Open" makes it permanent; setting `editor.tabs.preview` turns previews off. **Pinning** (Lucide `pin` icon): pinned tabs sit left and survive every bulk close. **Close actions**: close, close other tabs, close all, close to the left / right, close unmodified; the unsaved files of one action are asked about once with a list (Save All / Don't Save / Cancel). **Reopen Closed Tab**: a stack of the last 30 closed tabs per window, reopened at their place with selection and scroll position. **Split**: Split Right / Split Down add a second editor group (at most two) showing the active tab; Move Tab to Other Group, Focus Other Group, Unsplit; the same file in both groups is one engine buffer with one text, selection and undo history; the focused group is marked. A **tab context menu** (right click) runs all of these. Commands `tabs.*` in the registry (palette, a new Window menu group, agents); no default shortcuts. The layout of each project (groups, tabs, pins, previews, active tabs) is stored in Lutra's own state file (`layout.get` / `layout.set`, `<data_dir>/layout/`) and restored when the project opens. Vitest (model and area tests); live check over `--control` on Windows 11. Missing: reorder by drag, dragging tabs between groups, more than two groups, a tab limit, a recent-files switcher, duplicate-name disambiguation, diff tabs in the second group, per-group scroll for the same file (both groups share one selection).
|
||||
- [ ] Editor syntax highlighting (Lutra's own colours, no copied scheme)
|
||||
- M2.2 (2026-10-16): the language is picked from the file extension when a tab opens: PHP (with the HTML, CSS and JavaScript around `<?php` blocks), HTML, CSS, JS/TS, JSON, YAML, Markdown; other files stay plain. Eleven syntax tokens (`--lt-syntax-keyword/string/number/comment/variable/function/type/constant/tag/attribute/operator`) in both themes, each ≥ 4.5:1 on the editor background and the active line. `editor.reveal {path, line, column}` (UI command, palette, control channel) opens the file, activates the tab, places the cursor and centres it. Checked in the app on Windows 11 (bundled UI, control channel): PHP with embedded HTML in dark and light, `editor.reveal` into a closed CRLF file (last line, then line 302 centred). Vitest; keystroke to highlight on a 1 MB PHP file 3.0–11.4 ms median (jsdom, JavaScript work only, measured, not yet in the WebView). Missing: semantic highlighting (from the language server), a colour scheme editor, more languages (XML, SQL, Twig, Blade, .env), font styles (bold/italic) per token.
|
||||
- [ ] Restore dialog for unsaved changes after a crash
|
||||
|
|
@ -52,6 +53,7 @@
|
|||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-08 | minor | Tab management: preview, pin, close actions, reopen closed tab, split into two groups, stored layout (C10 A1) |
|
||||
| 2026-11-02 | minor | Four more themes, theme picker, theme file import, editor font family and line height (C9 T1) |
|
||||
| 2026-11-01 | patch | Chunk popup from the gutter and the diff viewer, staged markers, partly staged rows (C8 C3) |
|
||||
| 2026-10-31 | patch | Changes context menu with Add to .gitignore and the merge message prefill (C7 A3) |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue