Files
openidea/src/workbench/shellActions.ts
T
l0ng-ai 1e00ea5ee2 feat: Third pass aligning core experience with IntelliJ IDEA
Project & files
- Project view modes (Project Files / Open Files / All Changed Files /
  Scratches); External Libraries for Python, JDK (src.zip), Node, Cargo, Go,
  Maven/Gradle jars; read-only jar/zip browsing
- ⌘N New popup with type search and more file kinds; New Project, Rename
  Project, Reload All from Disk, Export/Import Settings, Power Save Mode
- File type associations, extra content roots and exclude patterns (indexed
  and watched without reopening the project)

Editor & navigation
- Find bar: search scope (comments/strings), Preserve Case, Exclude, multiline,
  history; Find in Files: Module scope, custom pattern scopes, multiline
- Search Everywhere filters, Assign Shortcut, settings results; named bookmark
  lists, file/folder bookmarks; Structure filters and Show Inherited; Recent
  Locations timestamps and breadcrumbs; Code Vision author
- Completion options, editor tab placement/layout, inline completion (LSP 3.18)
- Spell checking (Typo inspection, ide-spell) and Inspections settings with
  custom profiles; Code Style schemes, formatter markers, Do not format

Run, VCS, services, database
- Typed run configurations (Shell, Program, npm, Gradle, Maven, Docker,
  Compound), Modify options, Before launch, env dialog, Current File,
  Emulate terminal (PTY)
- Git log graph/view options, Go to Hash/Branch/Tag, date filter keeps the
  graph; Pull/Merge/Rebase dialogs, Manage Remotes, Worktrees
- Generic Services host (Docker connections/registries, run sessions); TODO
  scope/changes tabs with changelists; Coverage report import
- Data sources: wire-compatible vendors, URL import, SSL certs, Options,
  Schemas and Advanced tabs, color and comment

Workbench
- Run Anything, Customize Main Toolbar, named tool window layouts, menu
  completeness, Code Cleanup, macros, "Don't Show Again", editor banners
- Chinese translations for the new UI

Claude-Session: https://claude.ai/code/session_01SaPPsVPuk6ZTNsoUCNCbMv
2026-10-25 21:24:00 +08:00

106 lines
3.4 KiB
TypeScript

import { executeAction, getAction, registerActions } from "@/platform/actions";
import { isTauri } from "@/platform/ipc";
import { closeProject, confirmLeaveProject, openProject, useProject } from "@/platform/project";
import { runSearchFieldCommand, showContextMenu } from "@/ui";
import { showCustomizeToolbar } from "./MainToolbarDialog";
import { quickSwitchItems } from "./quickSwitch";
import { notify } from "./notificationStore";
import { NOTIFICATIONS_TOOL_WINDOW } from "./Notifications";
import { activateToolWindow } from "./toolwindows/store";
import { toggleTheme } from "./theme";
export async function openProjectDialog() {
if (!isTauri()) {
notify({
level: "warning",
title: "Opening folders requires the desktop app",
body: "Run `pnpm tauri dev` to use the file system.",
});
return;
}
const { open } = await import("@tauri-apps/plugin-dialog");
const defaultPath = useProject.getState().settings?.general?.defaultProjectDirectory?.trim() || undefined;
const picked = await open({ directory: true, multiple: false, title: "Open Folder", defaultPath });
const path = Array.isArray(picked) ? picked[0] : picked;
if (!path) return;
// The app feature applies "Open project in" (new / this window / ask).
if (getAction("file.openProjectPath")) {
await executeAction("file.openProjectPath", path);
return;
}
try {
await openProject(path);
} catch (e) {
notify({ level: "error", title: "Could not open project", body: e instanceof Error ? e.message : String(e) });
}
}
/** Generic actions owned by the shell. */
export function registerShellActions(): () => void {
return registerActions([
{
id: "file.openProject",
title: "Open…",
category: "File",
icon: "folder-open",
keywords: ["folder", "project"],
run: openProjectDialog,
},
{
id: "file.closeProject",
title: "Close Project",
category: "File",
when: "projectOpen",
run: async () => {
if (useProject.getState().project && (await confirmLeaveProject())) await closeProject();
},
},
{
id: "view.toggleTheme",
title: "Toggle Light/Dark Theme",
category: "View",
icon: "sun",
keywords: ["appearance", "theme"],
run: toggleTheme,
},
{
id: "view.quickSwitchScheme",
title: "Quick Switch Scheme…",
category: "View",
keywords: ["theme", "color scheme", "keymap", "view mode"],
run: () => showContextMenu({ x: window.innerWidth / 2 - 120, y: 96 }, quickSwitchItems()),
},
{
id: "toolbar.customize",
title: "Customize Main Toolbar…",
category: "View",
keywords: ["toolbar", "widgets", "title bar"],
run: showCustomizeToolbar,
},
{
id: "view.notifications",
title: "Notifications",
category: "View",
icon: "bell",
run: () => activateToolWindow(NOTIFICATIONS_TOOL_WINDOW),
},
// Keys of search fields (find bar, Find in Files) that are editor shortcuts elsewhere.
{
id: "find.field.newLine",
title: "New Line in Search Field",
category: "Find",
hidden: true,
when: "searchFieldNewLine",
run: () => void runSearchFieldCommand("newLine"),
},
{
id: "find.field.recentSearches",
title: "Recent Searches",
category: "Find",
hidden: true,
when: "searchFieldHistory",
run: () => void runSearchFieldCommand("history"),
},
]);
}