M2.6: go-to popup for files, classes and symbols
One popup with Files / Classes / Symbols tabs (Tab switches), opened by
goto.fileOpen (Mod+P), goto.classOpen (Mod+Alt+C) and goto.symbolOpen
(Mod+T), each with an optional {query} for agents. Live debounced query
against goto.* with stale answers dropped, matched characters marked,
directory / namespace / container column, library rows labelled, an
indexing hint with progress and a re-query on indexReady. Enter or a
click opens through editor.reveal; Escape closes. An exclusive modal and
a launcher: any other command closes it.
goto.file items now carry `library` (PM decision). indexProgress and
indexReady join the ipc event union. Notes in plan/phpstorm/08-goto.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ef198f5f8f
commit
943ff889df
21 changed files with 1650 additions and 23 deletions
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* The modal rule (M1.15): at most one modal is open at a time.
|
||||
*
|
||||
* - **Exclusive modals:** the command palette, the settings dialog and the
|
||||
* close question of a dirty tab. Opening one closes the one that is open
|
||||
* - **Exclusive modals:** the command palette, the go-to popup (M2.6), the
|
||||
* settings dialog and the close question of a dirty tab. Opening one closes the one that is open
|
||||
* (the close question closes as Cancel). Each reports itself with
|
||||
* {@link useModalsStore}'s `opened` and `closed`; the close question is
|
||||
* followed from the editor store, so the editor needs no code for it.
|
||||
|
|
@ -14,14 +14,15 @@
|
|||
* - **The palette is a launcher:** running any command other than
|
||||
* `palette.open` closes it first (see `store.ts` › `execute`), so a
|
||||
* `uiCommand` from the control channel never leaves it open behind
|
||||
* what the command shows.
|
||||
* what the command shows. The go-to popup is a launcher too: any command
|
||||
* but the go-to open commands closes it.
|
||||
*/
|
||||
import { defineStore } from "pinia";
|
||||
import { ref, watch } from "vue";
|
||||
import { useEditorStore } from "../stores/editor";
|
||||
|
||||
/** The exclusive modals. */
|
||||
export type ModalId = "palette" | "settings" | "closePrompt";
|
||||
export type ModalId = "palette" | "goto" | "settings" | "closePrompt";
|
||||
|
||||
/** Store of the open exclusive modal. */
|
||||
export const useModalsStore = defineStore("modals", () => {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ export interface PaletteEntry {
|
|||
/** Most recently run commands remembered. */
|
||||
export const MAX_RECENT = 20;
|
||||
|
||||
/** The UI commands that open the go-to popup, which therefore keep it open. */
|
||||
const GOTO_OPEN = new Set(["goto.fileOpen", "goto.classOpen", "goto.symbolOpen"]);
|
||||
|
||||
/**
|
||||
* Reads the command list from the engine, keeping well-formed entries.
|
||||
*
|
||||
|
|
@ -184,7 +187,8 @@ export const useCommandsStore = defineStore("commands", () => {
|
|||
* Runs a command the user chose (keyboard or palette): through its
|
||||
* handler if a component supplied one, else through the engine. A
|
||||
* disabled command does nothing. A failure raises an error toast. Any
|
||||
* command but `palette.open` closes the palette before it runs.
|
||||
* command but `palette.open` closes the palette before it runs, and any
|
||||
* command but the go-to open commands closes the go-to popup.
|
||||
*
|
||||
* @param id - the command id.
|
||||
* @param params - the params.
|
||||
|
|
@ -197,6 +201,9 @@ export const useCommandsStore = defineStore("commands", () => {
|
|||
if (id !== "palette.open") {
|
||||
modals.dismiss("palette");
|
||||
}
|
||||
if (!GOTO_OPEN.has(id)) {
|
||||
modals.dismiss("goto");
|
||||
}
|
||||
const handler = handlers.get(id);
|
||||
if (handler) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ export interface UiCommandSpec {
|
|||
export const UI_COMMANDS: readonly UiCommandSpec[] = [
|
||||
{ id: "editor.reveal", labelKey: "command.editor.reveal" },
|
||||
{ id: "find.open", labelKey: "command.find.open", defaultShortcut: "Mod+Alt+F" },
|
||||
{ id: "goto.classOpen", labelKey: "command.goto.classOpen", defaultShortcut: "Mod+Alt+C" },
|
||||
{ id: "goto.fileOpen", labelKey: "command.goto.fileOpen", defaultShortcut: "Mod+P" },
|
||||
{ id: "goto.symbolOpen", labelKey: "command.goto.symbolOpen", defaultShortcut: "Mod+T" },
|
||||
{ id: "palette.open", labelKey: "command.palette.open", defaultShortcut: "Mod+Shift+P" },
|
||||
{ id: "settings.open", labelKey: "command.settings.open", defaultShortcut: "Mod+," },
|
||||
{ id: "view.toggleProjectTree", labelKey: "command.view.toggleProjectTree", defaultShortcut: "Mod+1" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue