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 |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue