- Banner inside the editor pane for a dirty tab whose file changed (Reload (discard mine) / Keep mine / Compare) or was deleted (Keep as unsaved / Close); state in stores/diskConflicts.ts, the old notice is gone. - Save and save all ask Overwrite / Cancel when the engine refuses with disk_changed. - Diff tabs against the disk text (file.readDisk) and a Local History entry (history.read); "Revert to This" in the caption. - Show Local History dialog (history.show: tree context menu, palette, File menu) with Show Diff and an undoable Revert to This. - History failures warn once until a snapshot works again. - Docs: docs/local-history.md, G2 in gaps.md, ui-parity, architecture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
6.2 KiB
TypeScript
78 lines
6.2 KiB
TypeScript
/**
|
|
* UI commands: commands the frontend runs itself. They are registered with
|
|
* the engine (`ui.registerCommands`) so `listCommands`, the palette, the
|
|
* keymap and agents see them; running one through the engine comes back as
|
|
* a `uiCommand` event. Components supply the behaviour with
|
|
* `useCommandsStore().provide(id, handler)`; a UI command nobody provides
|
|
* is disabled.
|
|
*/
|
|
|
|
import { TAB_UI_COMMANDS } from "../components/editor/tabs/commands";
|
|
|
|
/** A UI command as registered with the engine. */
|
|
export interface UiCommandSpec {
|
|
/** Command id, `area.action` in camelCase. */
|
|
id: string;
|
|
/** Catalog key of the label. */
|
|
labelKey: string;
|
|
/** Menu path with `/` separators. */
|
|
menuPath?: string;
|
|
/** Default shortcut in Lutra notation. */
|
|
defaultShortcut?: string;
|
|
}
|
|
|
|
/** The frontend's UI commands. */
|
|
export const UI_COMMANDS: readonly UiCommandSpec[] = [
|
|
{ id: "deployment.browse", labelKey: "command.deployment.browse", menuPath: "Tools/Deployment/Remote Host" },
|
|
{ id: "deployment.compare", labelKey: "command.deployment.compare", menuPath: "Tools/Deployment/Compare Current File with Server" },
|
|
{ id: "deployment.sync", labelKey: "command.deployment.sync", menuPath: "Tools/Deployment/Sync Project with Server…" },
|
|
{ id: "deployment.download", labelKey: "command.deployment.download", menuPath: "Tools/Deployment/Download Current File" },
|
|
{ id: "deployment.servers", labelKey: "command.deployment.servers", menuPath: "Tools/Deployment/Servers…" },
|
|
{ id: "deployment.showLog", labelKey: "command.deployment.showLog", menuPath: "Tools/Deployment/Deployment Log" },
|
|
{ id: "deployment.testConnection", labelKey: "command.deployment.testConnection", menuPath: "Tools/Deployment/Test Connection" },
|
|
{ id: "deployment.upload", labelKey: "command.deployment.upload", menuPath: "Tools/Deployment/Upload Current File" },
|
|
{ id: "deployment.uploadProject", labelKey: "command.deployment.uploadProject", menuPath: "Tools/Deployment/Upload Project" },
|
|
{ id: "editor.reveal", labelKey: "command.editor.reveal" },
|
|
{ id: "editor.complete", labelKey: "command.editor.complete", menuPath: "Edit/Complete Code" },
|
|
{ id: "editor.quickDocumentation", labelKey: "command.editor.quickDocumentation", menuPath: "Edit/Quick Documentation", defaultShortcut: "Mod+I" },
|
|
{ id: "editor.parameterInfo", labelKey: "command.editor.parameterInfo", menuPath: "Edit/Parameter Info" },
|
|
{ id: "history.show", labelKey: "command.history.show", menuPath: "File/Show Local History" },
|
|
{ id: "find.open", labelKey: "command.find.open", menuPath: "View/Find in Files…", defaultShortcut: "Mod+Alt+F" },
|
|
{ id: "goto.classOpen", labelKey: "command.goto.classOpen", menuPath: "Go/Class…", defaultShortcut: "Mod+Alt+C" },
|
|
{ id: "goto.fileOpen", labelKey: "command.goto.fileOpen", menuPath: "Go/File…", defaultShortcut: "Mod+P" },
|
|
{ id: "goto.symbolOpen", labelKey: "command.goto.symbolOpen", menuPath: "Go/Symbol…", defaultShortcut: "Mod+T" },
|
|
{ id: "menu.open", labelKey: "command.menu.open", defaultShortcut: "Alt+M" },
|
|
{ id: "palette.open", labelKey: "command.palette.open", menuPath: "View/Command Palette", defaultShortcut: "Mod+Shift+P" },
|
|
{ id: "problems.open", labelKey: "command.problems.open", menuPath: "View/Problems", defaultShortcut: "Mod+Alt+P" },
|
|
{ id: "settings.open", labelKey: "command.settings.open", menuPath: "View/Settings…", defaultShortcut: "Mod+," },
|
|
{ id: "terminal.open", labelKey: "command.terminal.open", menuPath: "View/Terminal", defaultShortcut: "Mod+Shift+T" },
|
|
{ id: "view.toggleProjectTree", labelKey: "command.view.toggleProjectTree", menuPath: "View/Project", defaultShortcut: "Mod+1" },
|
|
{ id: "vcs.branches", labelKey: "command.vcs.branches", menuPath: "Git/Branches…" },
|
|
{ id: "vcs.checkout", labelKey: "command.vcs.checkout" },
|
|
{ id: "vcs.clone", labelKey: "command.vcs.clone", menuPath: "Git/Clone Repository…" },
|
|
{ id: "vcs.commit", labelKey: "command.vcs.commit", menuPath: "Git/Commit…", defaultShortcut: "Mod+Alt+Shift+M" },
|
|
{ id: "vcs.fetch", labelKey: "command.vcs.fetch", menuPath: "Git/Fetch" },
|
|
{ id: "vcs.manageRemotes", labelKey: "command.vcs.manageRemotes", menuPath: "Git/Manage Remotes…" },
|
|
{ id: "vcs.newBranch", labelKey: "command.vcs.newBranch", menuPath: "Git/New Branch…" },
|
|
{ id: "vcs.merge", labelKey: "command.vcs.merge", menuPath: "Git/Merge…" },
|
|
{ id: "vcs.resolveConflicts", labelKey: "command.vcs.resolveConflicts", menuPath: "Git/Resolve Conflicts…" },
|
|
{ id: "vcs.abortMerge", labelKey: "command.vcs.abortMerge", menuPath: "Git/Abort Merge…" },
|
|
{ id: "vcs.openChanges", labelKey: "command.vcs.openChanges", menuPath: "Git/Changes", defaultShortcut: "Mod+Alt+Shift+G" },
|
|
{ id: "vcs.pull", labelKey: "command.vcs.pull", menuPath: "Git/Pull" },
|
|
{ id: "vcs.push", labelKey: "command.vcs.push", menuPath: "Git/Push" },
|
|
{ id: "vcs.refresh", labelKey: "command.vcs.refresh", menuPath: "Git/Refresh Changes" },
|
|
{ id: "vcs.showLog", labelKey: "command.vcs.showLog", menuPath: "Git/Log" },
|
|
{ id: "vcs.showHistory", labelKey: "command.vcs.showHistory", menuPath: "Git/Show History" },
|
|
{ id: "vcs.stash", labelKey: "command.vcs.stash", menuPath: "Git/Stash Changes…" },
|
|
{ id: "vcs.showStashes", labelKey: "command.vcs.showStashes", menuPath: "Git/Stashes…" },
|
|
{ id: "vcs.showCommit", labelKey: "command.vcs.showCommit" },
|
|
{ id: "vcs.toggleBlame", labelKey: "command.vcs.toggleBlame", menuPath: "Git/Annotate with Git Blame" },
|
|
{ id: "vcs.showChunk", labelKey: "command.vcs.showChunk", menuPath: "Git/Show Changed Chunk" },
|
|
{ id: "vcs.showDiff", labelKey: "command.vcs.showDiff", menuPath: "Git/Show Diff", defaultShortcut: "Mod+Alt+Shift+D" },
|
|
{ id: "vcs.nextChange", labelKey: "command.vcs.nextChange", menuPath: "Git/Next Change", defaultShortcut: "Alt+Shift+]" },
|
|
{ id: "vcs.previousChange", labelKey: "command.vcs.previousChange", menuPath: "Git/Previous Change", defaultShortcut: "Alt+Shift+[" },
|
|
{ id: "view.toggleStructure", labelKey: "command.view.toggleStructure", menuPath: "View/Structure", defaultShortcut: "Mod+2" },
|
|
{ id: "view.selectTheme", labelKey: "command.view.selectTheme", menuPath: "View/Select Theme…" },
|
|
{ id: "view.importTheme", labelKey: "command.view.importTheme", menuPath: "View/Import Theme…" },
|
|
...TAB_UI_COMMANDS,
|
|
];
|