дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
Порівняти коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
60882d647f | ||
|
|
1ad8b06a1a | ||
|
|
2ca0e195e5 | ||
|
|
9c0dcb94cf |
No files matched your search
@@ -113,3 +113,60 @@ test("stops at a breakpoint, shows frames and variables, steps and resumes", asy
|
||||
await expect.poll(() => ipcCalls(page, "debug_resume")).toHaveLength(1);
|
||||
await expect(debug.getByText("CreateOrderRequest(sku='A-1', qty=2)")).toBeHidden();
|
||||
});
|
||||
|
||||
test("Evaluate keeps a multiline expression and its result visible in a short dialog", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 580, height: 420 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async (session) => {
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.debug_capabilities = () => ({});
|
||||
handlers.debug_completions = () => [];
|
||||
handlers.debug_evaluate_in = () => ({
|
||||
name: "orderSummary",
|
||||
typeName: "OrderSummary",
|
||||
value: "total = 36",
|
||||
variablesReference: 210,
|
||||
evaluateName: null,
|
||||
});
|
||||
handlers.debug_variables = () => [
|
||||
{ name: "tax", value: "4", typeName: "int", variablesReference: 0, evaluateName: null },
|
||||
];
|
||||
const stateModule = "/src/features/debugger/state.ts";
|
||||
const { adoptSession } = await import(/* @vite-ignore */ stateModule);
|
||||
adoptSession(session, { name: "Checkout", adapter: "debugpy", status: "paused", selectedFrame: 11 });
|
||||
}, SESSION);
|
||||
|
||||
await page.keyboard.press("Alt+F8");
|
||||
const dialog = page.getByRole("dialog", { name: "Evaluate expression" });
|
||||
const field = dialog.getByRole("textbox", { name: "Expression" });
|
||||
const expression = ["orderSummary(", ...Array.from({ length: 12 }, (_, i) => ` item${i},`), ")"].join("\n");
|
||||
await field.fill(expression);
|
||||
await field.press("Enter");
|
||||
const result = dialog.getByRole("tree", { name: "Evaluation result" });
|
||||
const row = result.getByRole("treeitem").first();
|
||||
await expect(row).toContainText("total = 36");
|
||||
await expect
|
||||
.poll(() =>
|
||||
dialog.locator("[data-dialog-body]").evaluate((body) => {
|
||||
const area = body.querySelector("textarea")!;
|
||||
const resultRow = body.querySelector('[role="treeitem"]')!.getBoundingClientRect();
|
||||
const bounds = body.getBoundingClientRect();
|
||||
return (
|
||||
body.scrollHeight <= body.clientHeight + 1 &&
|
||||
area.scrollHeight > area.clientHeight &&
|
||||
resultRow.top >= bounds.top &&
|
||||
resultRow.bottom <= bounds.bottom
|
||||
);
|
||||
}),
|
||||
)
|
||||
.toBe(true);
|
||||
await row.click();
|
||||
await row.press("ArrowRight");
|
||||
await expect(result.getByText("tax", { exact: true })).toBeVisible();
|
||||
|
||||
await field.fill("otherExpression");
|
||||
await dialog.getByRole("button", { name: "History", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: /orderSummary/ }).click();
|
||||
await expect(field).toHaveValue(expression);
|
||||
await expect(field).toBeFocused();
|
||||
});
|
||||
@@ -232,6 +232,48 @@ test("⌘R replaces every match in the file", async ({ workbench: page }) => {
|
||||
await expect(editor.locator(".cm-line", { hasText: "OrderDto" })).toHaveCount(2);
|
||||
});
|
||||
|
||||
test("the inline find and replace controls stay inside a narrow editor pane", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1120, height: 760 });
|
||||
const editor = await openFromTree(page, "build.gradle.kts");
|
||||
await editor.locator(".cm-content").click();
|
||||
await page.keyboard.press("Meta+r");
|
||||
const bar = page.getByRole("search", { name: "Replace in file" });
|
||||
const find = bar.getByRole("textbox", { name: "Find" });
|
||||
const replace = bar.getByRole("textbox", { name: "Replace" });
|
||||
const next = bar.getByRole("button", { name: /Next Occurrence/ });
|
||||
await find.fill("OrderDto");
|
||||
await find.press("Tab");
|
||||
await expect(replace).toBeFocused();
|
||||
await replace.fill("OrderView");
|
||||
const navigationIsBelowFind = async () => {
|
||||
const [input, button] = await Promise.all([find.boundingBox(), next.boundingBox()]);
|
||||
return !!input && !!button && button.y >= input.y + input.height;
|
||||
};
|
||||
const controlsFit = () =>
|
||||
bar.evaluate((panel) => {
|
||||
const bounds = panel.getBoundingClientRect();
|
||||
return [...panel.querySelectorAll("button, textarea")].every((element) => {
|
||||
const control = element.getBoundingClientRect();
|
||||
return control.width > 0 && control.left >= bounds.left && control.right <= bounds.right;
|
||||
});
|
||||
});
|
||||
await expect.poll(navigationIsBelowFind).toBe(false);
|
||||
|
||||
await page.setViewportSize({ width: 590, height: 760 });
|
||||
await expect.poll(controlsFit).toBe(true);
|
||||
await expect.poll(navigationIsBelowFind).toBe(true);
|
||||
await page.setViewportSize({ width: 495, height: 760 });
|
||||
await expect.poll(controlsFit).toBe(true);
|
||||
await expect(find).toHaveValue("OrderDto");
|
||||
await expect(replace).toHaveValue("OrderView");
|
||||
await next.click();
|
||||
await expect(bar.getByText(/^[12]\/2$/)).toBeVisible();
|
||||
await bar.getByRole("button", { name: "Replace All" }).click();
|
||||
await expect(editor.locator(".cm-line", { hasText: "OrderView" })).toHaveCount(2);
|
||||
await bar.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await expect(bar).toBeHidden();
|
||||
});
|
||||
|
||||
test("Markdown preview highlights ⌘F matches, selected words and scales diagrams with font zoom", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
@@ -596,3 +638,15 @@ test("dragging the Markdown split divider resizes and reflows editor and preview
|
||||
.poll(async () => Math.round((await reopenedEditor.boundingBox())!.width))
|
||||
.toBe(Math.round(initialEditor));
|
||||
});
|
||||
|
||||
test("Markdown Preview only leaves the Project view clickable", async ({ workbench: page }) => {
|
||||
await openFromTree(page, "README.md");
|
||||
await page.getByRole("button", { name: "Preview Only" }).click();
|
||||
await expect(page.getByRole("document", { name: "Markdown preview" })).toBeVisible();
|
||||
|
||||
const row = page.getByRole("treeitem", { name: "build.gradle.kts", exact: true });
|
||||
// A hidden editor panel used to leave an implicit resize region over everything left of the preview,
|
||||
// which swallowed the click.
|
||||
await row.click();
|
||||
await expect(row).toHaveAttribute("aria-selected", "true");
|
||||
});
|
||||
@@ -151,52 +151,126 @@
|
||||
}
|
||||
|
||||
/* Find / replace bar */
|
||||
.find {
|
||||
.findContainer {
|
||||
flex: none;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(220px, 420px) auto 1fr;
|
||||
align-items: center;
|
||||
column-gap: var(--space-1-5);
|
||||
row-gap: var(--space-1-5);
|
||||
padding: 6px 8px 6px 10px;
|
||||
min-width: 0;
|
||||
container: editor-find / inline-size;
|
||||
background: var(--bg-editor-inline, var(--bg-elev));
|
||||
border-bottom: 1px solid var(--border-editor-tabs, var(--border));
|
||||
}
|
||||
.findExpandable {
|
||||
grid-template-columns: auto minmax(220px, 420px) auto 1fr;
|
||||
.find {
|
||||
display: grid;
|
||||
grid-template-columns: [mode] auto [field] minmax(0, 420px) [actions] fit-content(50%) [close] minmax(
|
||||
min-content,
|
||||
1fr
|
||||
);
|
||||
align-items: start;
|
||||
row-gap: var(--space-1);
|
||||
padding: var(--space-1-5) var(--space-2);
|
||||
}
|
||||
.findExpand {
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
}
|
||||
.findExpandable .findField {
|
||||
grid-column: 2;
|
||||
grid-area: 1 / mode;
|
||||
margin-inline-end: var(--space-1);
|
||||
}
|
||||
.findField {
|
||||
grid-area: 1 / field;
|
||||
}
|
||||
.replaceField {
|
||||
grid-area: 2 / field;
|
||||
}
|
||||
.findField,
|
||||
.replaceField {
|
||||
min-width: 0;
|
||||
}
|
||||
.findButtons {
|
||||
.findClose {
|
||||
grid-area: 1 / close;
|
||||
justify-self: end;
|
||||
margin-inline-start: var(--space-1);
|
||||
}
|
||||
.findExpand,
|
||||
.findClose {
|
||||
margin-block-start: var(--space-1);
|
||||
}
|
||||
.findButtons,
|
||||
.replaceButtons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
min-height: var(--h-field);
|
||||
margin-inline-start: var(--space-1-5);
|
||||
}
|
||||
.findButtons {
|
||||
grid-area: 1 / actions;
|
||||
gap: var(--space-0-5);
|
||||
}
|
||||
.replaceButtons {
|
||||
grid-area: 2 / actions;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
.findCount {
|
||||
font-size: var(--fs-ui);
|
||||
min-inline-size: 5ch;
|
||||
padding-inline: var(--space-1);
|
||||
font-size: var(--fs-small);
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--fg-subtle);
|
||||
padding: 0 8px 0 4px;
|
||||
min-width: 56px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.findCountNone {
|
||||
color: var(--danger);
|
||||
}
|
||||
.findClose {
|
||||
justify-self: end;
|
||||
|
||||
@container editor-find (width < 500px) {
|
||||
.find {
|
||||
grid-template-columns: [mode] auto [field] minmax(0, 1fr) [close] auto;
|
||||
}
|
||||
.findButtons,
|
||||
.replaceButtons {
|
||||
grid-column: field / -1;
|
||||
min-height: 0;
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
.findButtons {
|
||||
grid-row: 2;
|
||||
}
|
||||
.replaceField {
|
||||
grid-row: 3;
|
||||
}
|
||||
.replaceButtons {
|
||||
grid-row: 4;
|
||||
}
|
||||
.replaceButtons > button {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
min-height: var(--h-control);
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
}
|
||||
.replaceButtons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1-5);
|
||||
|
||||
@container editor-find (width < 224px) {
|
||||
.findField,
|
||||
.replaceField,
|
||||
.replaceButtons {
|
||||
grid-column: mode / -1;
|
||||
}
|
||||
.findExpand,
|
||||
.findClose {
|
||||
grid-row: 2;
|
||||
margin-block-start: 0;
|
||||
}
|
||||
.findButtons {
|
||||
grid-column: field;
|
||||
}
|
||||
.findInput {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(20px, 1fr));
|
||||
height: auto;
|
||||
padding-block: var(--space-1);
|
||||
}
|
||||
.findInput textarea {
|
||||
grid-column: 2 / -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Go to line */
|
||||
|
||||
@@ -608,182 +608,185 @@ export function FindPanel({ target, version, replace, seq, onReplaceShown, onClo
|
||||
const canReplace = !!opts.search && !invalid;
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={panelRef}
|
||||
onFocusCapture={() => {
|
||||
focusedTarget = target;
|
||||
setContext("findBarFocus", true);
|
||||
setContext(
|
||||
"findBarHasResults",
|
||||
!!target.results && !!opts.search && (!opts.regexp || regexValid(opts.search)) && !!count?.total,
|
||||
);
|
||||
}}
|
||||
onBlurCapture={(e) => {
|
||||
if (!panelRef.current?.contains(e.relatedTarget as Node | null)) setContext("findBarFocus", false);
|
||||
}}
|
||||
className={clsx(styles.find, onReplaceShown && styles.findExpandable)}
|
||||
role="search"
|
||||
aria-label={replace ? "Replace in file" : "Find in file"}
|
||||
>
|
||||
{onReplaceShown && (
|
||||
<IconButton
|
||||
icon={replace ? "chevron-down" : "chevron-right"}
|
||||
title={replace ? "Hide Replace" : "Show Replace"}
|
||||
size="small"
|
||||
className={styles.findExpand}
|
||||
aria-expanded={replace}
|
||||
onMouseDown={(e) => e.preventDefault()}
|
||||
onClick={() => {
|
||||
if (replaceBoxRef.current?.contains(document.activeElement)) inputRef.current?.focus();
|
||||
onReplaceShown(!replace);
|
||||
}}
|
||||
<div className={styles.findContainer}>
|
||||
<div
|
||||
ref={panelRef}
|
||||
onFocusCapture={() => {
|
||||
focusedTarget = target;
|
||||
setContext("findBarFocus", true);
|
||||
setContext(
|
||||
"findBarHasResults",
|
||||
!!target.results && !!opts.search && (!opts.regexp || regexValid(opts.search)) && !!count?.total,
|
||||
);
|
||||
}}
|
||||
onBlurCapture={(e) => {
|
||||
if (!panelRef.current?.contains(e.relatedTarget as Node | null)) setContext("findBarFocus", false);
|
||||
}}
|
||||
className={styles.find}
|
||||
role="search"
|
||||
aria-label={replace ? "Replace in file" : "Find in file"}
|
||||
>
|
||||
{onReplaceShown && (
|
||||
<IconButton
|
||||
icon={replace ? "chevron-down" : "chevron-right"}
|
||||
title={replace ? "Hide Replace" : "Show Replace"}
|
||||
size="small"
|
||||
className={styles.findExpand}
|
||||
aria-expanded={replace}
|
||||
onMouseDown={(e) => e.preventDefault()}
|
||||
onClick={() => {
|
||||
if (replaceBoxRef.current?.contains(document.activeElement)) inputRef.current?.focus();
|
||||
onReplaceShown(!replace);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<div ref={findBoxRef} className={styles.findField}>
|
||||
<SearchField
|
||||
ref={inputRef}
|
||||
value={opts.search}
|
||||
onChange={(search) => setOpts({ search })}
|
||||
placeholder="Find"
|
||||
aria-label="Find"
|
||||
invalid={invalid || none}
|
||||
multiline
|
||||
onHistory={() => setHistoryMenu("find")}
|
||||
onKeyDown={(e) => onKeyDown(e, "find")}
|
||||
className={styles.findInput}
|
||||
toggles={[
|
||||
{
|
||||
id: "case",
|
||||
icon: "case",
|
||||
title: "Match Case",
|
||||
shortcut: formatBinding("Alt+C"),
|
||||
pressed: opts.caseSensitive,
|
||||
onToggle: () => toggle("caseSensitive"),
|
||||
},
|
||||
{
|
||||
id: "word",
|
||||
icon: "word",
|
||||
title: "Words",
|
||||
shortcut: formatBinding("Alt+W"),
|
||||
pressed: opts.wholeWord,
|
||||
onToggle: () => toggle("wholeWord"),
|
||||
},
|
||||
{
|
||||
id: "regex",
|
||||
icon: "regex",
|
||||
title: "Regex",
|
||||
shortcut: formatBinding("Alt+X"),
|
||||
pressed: opts.regexp,
|
||||
onToggle: () => toggle("regexp"),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.findButtons}>
|
||||
<span className={clsx(styles.findCount, (none || invalid) && styles.findCountNone)} aria-live="polite">
|
||||
{counter}
|
||||
</span>
|
||||
<IconButton
|
||||
icon="arrow-up"
|
||||
title="Previous Occurrence"
|
||||
shortcut={formatBinding("Shift+Enter")}
|
||||
size="small"
|
||||
onClick={() => run(findPrevious)}
|
||||
/>
|
||||
<IconButton
|
||||
icon="arrow-down"
|
||||
title="Next Occurrence"
|
||||
shortcut={formatBinding("Enter")}
|
||||
size="small"
|
||||
onClick={() => run(findNext)}
|
||||
/>
|
||||
<IconButton
|
||||
ref={filterRef}
|
||||
icon="filter"
|
||||
title="Filter Search Results"
|
||||
size="small"
|
||||
pressed={scoped || inChanges || opts.context !== "any"}
|
||||
onClick={() => setFilterMenu(true)}
|
||||
/>
|
||||
<IconButton ref={moreRef} icon="more" title="More" size="small" onClick={() => setMoreMenu(true)} />
|
||||
</div>
|
||||
<IconButton icon="close" title="Close" shortcut="⎋" size="small" className={styles.findClose} onClick={close} />
|
||||
{replace && (
|
||||
<>
|
||||
<div ref={replaceBoxRef} className={styles.replaceField}>
|
||||
<SearchField
|
||||
ref={replaceRef}
|
||||
value={opts.replace}
|
||||
onChange={(value) => setOpts({ replace: value })}
|
||||
placeholder="Replace"
|
||||
aria-label="Replace"
|
||||
multiline
|
||||
onHistory={() => setHistoryMenu("replace")}
|
||||
onKeyDown={(e) => onKeyDown(e, "replace")}
|
||||
toggles={[
|
||||
{
|
||||
id: "preserveCase",
|
||||
icon: "preserve-case",
|
||||
title: "Preserve Case",
|
||||
pressed: opts.preserveCase,
|
||||
onToggle: () => toggle("preserveCase"),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.replaceButtons}>
|
||||
<Button
|
||||
size="small"
|
||||
title={tx`Replace (${formatBinding("Alt+P")})`}
|
||||
onClick={doReplace}
|
||||
disabled={!canReplace}
|
||||
>
|
||||
<T>Replace</T>
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
title={tx`Replace All (${formatBinding("Alt+A")})`}
|
||||
onClick={doReplaceAll}
|
||||
disabled={!canReplace}
|
||||
>
|
||||
<T>Replace All</T>
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
title={
|
||||
count?.excluded ? tx`Include (${formatBinding("Alt+L")})` : tx`Exclude (${formatBinding("Alt+L")})`
|
||||
}
|
||||
onClick={() => run(excludeCurrent)}
|
||||
disabled={!canReplace || (!count?.total && !count?.excluded)}
|
||||
>
|
||||
{count?.excluded ? <T>Include</T> : <T>Exclude</T>}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<Menu
|
||||
open={historyMenu !== null}
|
||||
anchor={historyMenu === "replace" ? replaceBoxRef : findBoxRef}
|
||||
items={historyMenu ? historyItems(historyMenu) : []}
|
||||
placement="bottom-start"
|
||||
aria-label="Recent searches"
|
||||
onClose={() => setHistoryMenu(null)}
|
||||
/>
|
||||
)}
|
||||
<div ref={findBoxRef} className={styles.findField}>
|
||||
<SearchField
|
||||
ref={inputRef}
|
||||
value={opts.search}
|
||||
onChange={(search) => setOpts({ search })}
|
||||
placeholder="Find"
|
||||
aria-label="Find"
|
||||
invalid={invalid || none}
|
||||
multiline
|
||||
onHistory={() => setHistoryMenu("find")}
|
||||
onKeyDown={(e) => onKeyDown(e, "find")}
|
||||
toggles={[
|
||||
{
|
||||
id: "case",
|
||||
icon: "case",
|
||||
title: "Match Case",
|
||||
shortcut: formatBinding("Alt+C"),
|
||||
pressed: opts.caseSensitive,
|
||||
onToggle: () => toggle("caseSensitive"),
|
||||
},
|
||||
{
|
||||
id: "word",
|
||||
icon: "word",
|
||||
title: "Words",
|
||||
shortcut: formatBinding("Alt+W"),
|
||||
pressed: opts.wholeWord,
|
||||
onToggle: () => toggle("wholeWord"),
|
||||
},
|
||||
{
|
||||
id: "regex",
|
||||
icon: "regex",
|
||||
title: "Regex",
|
||||
shortcut: formatBinding("Alt+X"),
|
||||
pressed: opts.regexp,
|
||||
onToggle: () => toggle("regexp"),
|
||||
},
|
||||
]}
|
||||
<Menu
|
||||
open={moreMenu}
|
||||
anchor={moreRef}
|
||||
items={moreItems}
|
||||
placement="bottom-end"
|
||||
aria-label="Find options"
|
||||
onClose={() => setMoreMenu(false)}
|
||||
/>
|
||||
<Menu
|
||||
open={filterMenu}
|
||||
anchor={filterRef}
|
||||
items={filterItems}
|
||||
placement="bottom-end"
|
||||
aria-label="Filter search results"
|
||||
onClose={() => setFilterMenu(false)}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.findButtons}>
|
||||
<span className={clsx(styles.findCount, (none || invalid) && styles.findCountNone)} aria-live="polite">
|
||||
{counter}
|
||||
</span>
|
||||
<IconButton
|
||||
icon="arrow-up"
|
||||
title="Previous Occurrence"
|
||||
shortcut={formatBinding("Shift+Enter")}
|
||||
size="small"
|
||||
onClick={() => run(findPrevious)}
|
||||
/>
|
||||
<IconButton
|
||||
icon="arrow-down"
|
||||
title="Next Occurrence"
|
||||
shortcut={formatBinding("Enter")}
|
||||
size="small"
|
||||
onClick={() => run(findNext)}
|
||||
/>
|
||||
<IconButton
|
||||
ref={filterRef}
|
||||
icon="filter"
|
||||
title="Filter Search Results"
|
||||
size="small"
|
||||
pressed={scoped || inChanges || opts.context !== "any"}
|
||||
onClick={() => setFilterMenu(true)}
|
||||
/>
|
||||
<IconButton ref={moreRef} icon="more" title="More" size="small" onClick={() => setMoreMenu(true)} />
|
||||
</div>
|
||||
<IconButton icon="close" title="Close" shortcut="⎋" size="small" className={styles.findClose} onClick={close} />
|
||||
{replace && (
|
||||
<>
|
||||
<div ref={replaceBoxRef} className={styles.findField}>
|
||||
<SearchField
|
||||
ref={replaceRef}
|
||||
value={opts.replace}
|
||||
onChange={(value) => setOpts({ replace: value })}
|
||||
placeholder="Replace"
|
||||
aria-label="Replace"
|
||||
multiline
|
||||
onHistory={() => setHistoryMenu("replace")}
|
||||
onKeyDown={(e) => onKeyDown(e, "replace")}
|
||||
toggles={[
|
||||
{
|
||||
id: "preserveCase",
|
||||
icon: "preserve-case",
|
||||
title: "Preserve Case",
|
||||
pressed: opts.preserveCase,
|
||||
onToggle: () => toggle("preserveCase"),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.replaceButtons}>
|
||||
<Button
|
||||
size="small"
|
||||
title={tx`Replace (${formatBinding("Alt+P")})`}
|
||||
onClick={doReplace}
|
||||
disabled={!canReplace}
|
||||
>
|
||||
<T>Replace</T>
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
title={tx`Replace All (${formatBinding("Alt+A")})`}
|
||||
onClick={doReplaceAll}
|
||||
disabled={!canReplace}
|
||||
>
|
||||
<T>Replace All</T>
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
title={
|
||||
count?.excluded ? tx`Include (${formatBinding("Alt+L")})` : tx`Exclude (${formatBinding("Alt+L")})`
|
||||
}
|
||||
onClick={() => run(excludeCurrent)}
|
||||
disabled={!canReplace || (!count?.total && !count?.excluded)}
|
||||
>
|
||||
{count?.excluded ? <T>Include</T> : <T>Exclude</T>}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<Menu
|
||||
open={historyMenu !== null}
|
||||
anchor={historyMenu === "replace" ? replaceBoxRef : findBoxRef}
|
||||
items={historyMenu ? historyItems(historyMenu) : []}
|
||||
placement="bottom-start"
|
||||
aria-label="Recent searches"
|
||||
onClose={() => setHistoryMenu(null)}
|
||||
/>
|
||||
<Menu
|
||||
open={moreMenu}
|
||||
anchor={moreRef}
|
||||
items={moreItems}
|
||||
placement="bottom-end"
|
||||
aria-label="Find options"
|
||||
onClose={() => setMoreMenu(false)}
|
||||
/>
|
||||
<Menu
|
||||
open={filterMenu}
|
||||
anchor={filterRef}
|
||||
items={filterItems}
|
||||
placement="bottom-end"
|
||||
aria-label="Filter search results"
|
||||
onClose={() => setFilterMenu(false)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -172,31 +172,72 @@
|
||||
}
|
||||
|
||||
/* evaluate dialog */
|
||||
.evalDialog {
|
||||
height: min(440px, 100%);
|
||||
}
|
||||
|
||||
.evalBody {
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 12px 14px;
|
||||
padding: var(--space-2) var(--space-3) 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.evalExpression,
|
||||
.evalResult {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
/* Long fragments scroll inside the field so the result keeps its own space. */
|
||||
.evalExpression {
|
||||
max-height: 50%;
|
||||
}
|
||||
|
||||
.evalImport {
|
||||
flex: none;
|
||||
max-height: 40%;
|
||||
overflow: auto;
|
||||
padding: var(--space-1);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
align-content: start;
|
||||
gap: var(--space-1) var(--space-2);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.evalImport > button {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
min-height: var(--h-control);
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* Grows with the dialog when it is resized. */
|
||||
.evalResult {
|
||||
flex: 1;
|
||||
min-height: 220px;
|
||||
}
|
||||
|
||||
.evalResultContent {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid var(--border-popup);
|
||||
border-radius: var(--radius-small);
|
||||
padding: 4px 6px;
|
||||
padding: var(--space-0-5) var(--space-1);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.evalHint {
|
||||
padding: var(--space-2);
|
||||
color: var(--fg-muted);
|
||||
font-size: var(--fs-small);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.chooser {
|
||||
@@ -259,33 +300,38 @@
|
||||
/* Evaluate: a field that grows with ⇧Enter, like IDEA's expression editor. */
|
||||
.evalInputRow {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
.evalInput {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: var(--h-field, 28px);
|
||||
padding: 5px 8px;
|
||||
resize: none;
|
||||
appearance: none;
|
||||
border: 0;
|
||||
min-height: 0;
|
||||
border-radius: var(--radius-control, 4px);
|
||||
background: var(--bg-field, var(--bg-button));
|
||||
box-shadow: inset 0 0 0 1px var(--border-button);
|
||||
color: var(--fg-strong);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-ui);
|
||||
line-height: 18px;
|
||||
outline: none;
|
||||
-webkit-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
.evalInput:focus {
|
||||
.evalInputRow:focus-within {
|
||||
box-shadow:
|
||||
inset 0 0 0 1px var(--focus-ring),
|
||||
0 0 0 1px var(--focus-ring);
|
||||
}
|
||||
.evalInput {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
padding: var(--space-1) var(--space-2);
|
||||
resize: none;
|
||||
appearance: none;
|
||||
border: 0;
|
||||
background: none;
|
||||
color: var(--fg-strong);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-code);
|
||||
font-weight: var(--fw-code);
|
||||
line-height: var(--lh-code);
|
||||
outline: none;
|
||||
-webkit-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
.evalInput::placeholder {
|
||||
color: var(--fg-faint);
|
||||
}
|
||||
.evalHistory {
|
||||
align-self: flex-start;
|
||||
margin: var(--space-1);
|
||||
}
|
||||
@@ -764,8 +764,9 @@ function EvaluateDialogInner({ initial }: { initial: string }) {
|
||||
const [history, setHistory] = useState(() => readHistory("evaluate"));
|
||||
const [historyMenu, setHistoryMenu] = useState(false);
|
||||
const historyPos = useRef(-1);
|
||||
const historyButton = useRef<HTMLSpanElement>(null);
|
||||
const historyButton = useRef<HTMLButtonElement>(null);
|
||||
const field = useRef<HTMLTextAreaElement>(null);
|
||||
const expressionId = useId();
|
||||
const session = useDebug((s) => (s.active != null ? s.sessions[s.active] : undefined));
|
||||
const paused = session?.status === "paused";
|
||||
const close = () => useOverlays.setState({ evaluate: null });
|
||||
@@ -824,7 +825,10 @@ function EvaluateDialogInner({ initial }: { initial: string }) {
|
||||
onClose={close}
|
||||
title="Evaluate"
|
||||
width={620}
|
||||
minWidth={340}
|
||||
minHeight={240}
|
||||
resizable="both"
|
||||
className={styles.evalDialog}
|
||||
aria-label="Evaluate expression"
|
||||
footerStart={
|
||||
<Button
|
||||
@@ -844,13 +848,14 @@ function EvaluateDialogInner({ initial }: { initial: string }) {
|
||||
]}
|
||||
>
|
||||
<div className={styles.evalBody}>
|
||||
<div className={styles.field}>
|
||||
<span className={styles.label}>
|
||||
<div className={styles.evalExpression}>
|
||||
<label className={styles.label} htmlFor={expressionId}>
|
||||
<T>Expression</T>
|
||||
</span>
|
||||
</label>
|
||||
<div className={styles.evalInputRow}>
|
||||
<textarea
|
||||
ref={field}
|
||||
id={expressionId}
|
||||
className={styles.evalInput}
|
||||
rows={lines}
|
||||
value={expression}
|
||||
@@ -866,19 +871,22 @@ function EvaluateDialogInner({ initial }: { initial: string }) {
|
||||
spellCheck={false}
|
||||
autoComplete="off"
|
||||
data-autofocus=""
|
||||
aria-label={tx("Expression")}
|
||||
placeholder={paused ? "Expression to evaluate in the selected frame" : "Pause the program to evaluate"}
|
||||
placeholder={tx(
|
||||
paused ? "Expression to evaluate in the selected frame" : "Pause the program to evaluate",
|
||||
)}
|
||||
/>
|
||||
{completion.popup}
|
||||
<span ref={historyButton}>
|
||||
<IconButton
|
||||
icon="history"
|
||||
title="History"
|
||||
size="small"
|
||||
disabled={!history.length}
|
||||
onClick={() => setHistoryMenu(true)}
|
||||
/>
|
||||
</span>
|
||||
<IconButton
|
||||
ref={historyButton}
|
||||
className={styles.evalHistory}
|
||||
icon="history"
|
||||
title="History"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={historyMenu}
|
||||
disabled={!history.length}
|
||||
onClick={() => setHistoryMenu(true)}
|
||||
/>
|
||||
</div>
|
||||
<Menu
|
||||
open={historyMenu}
|
||||
@@ -891,32 +899,37 @@ function EvaluateDialogInner({ initial }: { initial: string }) {
|
||||
.map((h) => ({ label: h.replace(/\s+/g, " "), verbatim: true, run: () => recall(h) }))}
|
||||
/>
|
||||
</div>
|
||||
{ambiguous && (
|
||||
<div className={styles.evalImport} role="group" aria-label={tx("Class to import")}>
|
||||
<span className={styles.label}>{tx`Choose the class to import for ${className}:`}</span>
|
||||
{ambiguous.candidates.map((c) => (
|
||||
<Button
|
||||
key={c}
|
||||
variant="ghost"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
if (session) rememberImport(session.id, c);
|
||||
void run();
|
||||
}}
|
||||
>
|
||||
{c}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.evalResult}>
|
||||
{result ? (
|
||||
<VariablesView roots={[result]} session={session?.id ?? null} aria-label="Evaluation result" />
|
||||
) : (
|
||||
<div className={styles.empty}>
|
||||
{paused ? tx("Press Enter to evaluate") : tx("Evaluation is available while the program is suspended")}
|
||||
</div>
|
||||
)}
|
||||
<span className={styles.label}>
|
||||
<T>Result</T>
|
||||
</span>
|
||||
<div className={styles.evalResultContent}>
|
||||
{ambiguous && (
|
||||
<div className={styles.evalImport} role="group" aria-label={tx("Class to import")}>
|
||||
<span className={styles.label}>{tx`Choose the class to import for ${className}:`}</span>
|
||||
{ambiguous.candidates.map((c) => (
|
||||
<Button
|
||||
key={c}
|
||||
variant="ghost"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
if (session) rememberImport(session.id, c);
|
||||
void run();
|
||||
}}
|
||||
>
|
||||
{c}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{result ? (
|
||||
<VariablesView roots={[result]} session={session?.id ?? null} aria-label="Evaluation result" />
|
||||
) : (
|
||||
<div className={styles.evalHint}>
|
||||
{paused ? tx("Press Enter to evaluate") : tx("Evaluation is available while the program is suspended")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
@@ -27,6 +27,14 @@
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
.evalName {
|
||||
flex: 0 1 auto;
|
||||
max-width: 45%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.varName {
|
||||
color: var(--debug-name, var(--syn-property));
|
||||
}
|
||||
|
||||
@@ -487,13 +487,22 @@ function VarRow({
|
||||
);
|
||||
const kind = node.error ? null : classifyValue(node.value, node.typeName);
|
||||
const shown = shownValue(node.value, node.typeName);
|
||||
const evaluation = node.kind === "eval";
|
||||
return (
|
||||
<span className={styles.row}>
|
||||
<Icon name={nodeIcon(node)} size={16} className={styles.nodeIcon} />
|
||||
{!shown.entry && (
|
||||
<>
|
||||
<span className={clsx(styles.name, node.kind === "var" && styles.varName, changed && styles.changed)}>
|
||||
{node.name}
|
||||
<span
|
||||
className={clsx(
|
||||
styles.name,
|
||||
evaluation && styles.evalName,
|
||||
node.kind === "var" && styles.varName,
|
||||
changed && styles.changed,
|
||||
)}
|
||||
title={evaluation ? node.name : undefined}
|
||||
>
|
||||
{evaluation ? oneLine(node.name) : node.name}
|
||||
</span>
|
||||
<span className={styles.eq}>=</span>
|
||||
</>
|
||||
|
||||
@@ -122,7 +122,10 @@ export function MarkdownEditor({
|
||||
className={styles.group}
|
||||
storageKey={mode === "split" ? SPLIT_STORAGE_KEY : undefined}
|
||||
>
|
||||
<SplitPanel id="editor" style={{ overflow: "hidden" }} {...splitBounds}>
|
||||
{/* Hidden but mounted in Preview only (its caret drives the preview). Disabled, it leaves the group a
|
||||
single resizable panel: two enabled panels without a separator get an implicit resize region between
|
||||
them, which for a hidden panel spans everything left of the preview. */}
|
||||
<SplitPanel id="editor" style={{ overflow: "hidden" }} disabled={mode === "preview"} {...splitBounds}>
|
||||
<div ref={editorRef} className={styles.editor}>
|
||||
{children}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Заблокувати користувача