дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
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
67 рядки
2.3 KiB
TypeScript
67 рядки
2.3 KiB
TypeScript
/** IDEA's "New" popup (⌘N): the New › items under a "Search for file type" field. */
|
||
import { create } from "zustand";
|
||
import { getAction } from "@/platform/actions";
|
||
import { fuzzyMatch, resolveMenuItems, type MenuItem } from "@/ui";
|
||
|
||
export interface NewPopupRow {
|
||
key: string;
|
||
separator?: boolean;
|
||
label: string;
|
||
icon?: string;
|
||
shortcut?: string;
|
||
run?: () => void;
|
||
/** Matched label indices while filtering. */
|
||
matches?: number[] | null;
|
||
}
|
||
|
||
interface NewPopupState {
|
||
request: { at: { x: number; y: number }; items: MenuItem[]; seq: number } | null;
|
||
}
|
||
|
||
export const useNewPopup = create<NewPopupState>(() => ({ request: null }));
|
||
let seq = 0;
|
||
|
||
export function openNewPopup(at: { x: number; y: number }, items: MenuItem[]) {
|
||
useNewPopup.setState({ request: { at, items, seq: ++seq } });
|
||
}
|
||
|
||
export const closeNewPopup = () => useNewPopup.setState({ request: null });
|
||
|
||
/** Generic action keywords that would match every template. */
|
||
const GENERIC = new Set(["new", "create", "template", "file"]);
|
||
|
||
/**
|
||
* Enabled entries, filtered by `query`: label matches (highlighted), then
|
||
* entries whose action has a matching keyword (`css` finds Stylesheet).
|
||
* Separators are kept only without a query.
|
||
*/
|
||
export function newPopupRows(items: MenuItem[], query: string): NewPopupRow[] {
|
||
const q = query.trim();
|
||
const rows: NewPopupRow[] = [];
|
||
const byKeyword: NewPopupRow[] = [];
|
||
for (const r of resolveMenuItems(items)) {
|
||
if (r.kind === "separator") {
|
||
if (!q && rows.length && !rows[rows.length - 1]!.separator) rows.push({ key: r.key, separator: true, label: "" });
|
||
continue;
|
||
}
|
||
if (r.kind !== "item" || r.disabled || !r.run) continue;
|
||
const row: NewPopupRow = { key: r.key, label: r.label, icon: r.icon, shortcut: r.shortcut, run: r.run };
|
||
if (!q) {
|
||
rows.push(row);
|
||
continue;
|
||
}
|
||
const matches = fuzzyMatch(r.label, q);
|
||
if (matches) rows.push({ ...row, matches });
|
||
else if (keywordMatch(r.key, q)) byKeyword.push(row);
|
||
}
|
||
while (rows.length && rows[rows.length - 1]!.separator) rows.pop();
|
||
return [...rows, ...byKeyword];
|
||
}
|
||
|
||
function keywordMatch(actionId: string, q: string): boolean {
|
||
const lower = q.toLowerCase().replace(/^\./, "");
|
||
return !!getAction(actionId)?.keywords?.some(
|
||
(k) => !GENERIC.has(k) && k.toLowerCase().replace(/^\./, "").startsWith(lower),
|
||
);
|
||
}
|