Порівняти коміти

..
Автор SHA1 Повідомлення Дата
l0ng-ai b88aa70aff fix(run): keep configuration names distinct in gutter menus 2026-11-23 00:46:20 +08:00
l0ng-ai 81dd5f0dd2 fix(vcs): keep Git Log path selection in a resizable tree (#5218)
The Git Log path chooser now uses a compact, resizable dialog with a framed file tree. Files and folders have icons and use the standard workbench text size. Long names shorten inside their rows and show the full name on hover. The tree and the checked paths list scroll independently, keeping both reachable in a short window.
2026-11-22 22:57:50 +08:00
l0ng-ai 36061abc91 fix(debugger): lay out inline evaluation and history together (#5216)
The Variables pane now keeps Add to Watches and the history arrow at the trailing edge of the evaluation field. The field uses the configured editor font family at up to the workbench text size, and its short placeholder fits narrow docks. The history menu matches the field width and uses the existing Evaluate history for single-line expressions.
2026-11-22 22:24:43 +08:00
27 змінених файлів з 555 додано та 195 видалено

No files matched your search

+83
Переглянути файл
@@ -200,3 +200,86 @@ test("Evaluate keeps a multiline expression and its result visible in a short di
await expect(field).toHaveValue(expression);
await expect(field).toBeFocused();
});
test("Variables keeps evaluation, watches and expression history together in a narrow dock", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 720, height: 620 });
await stubDesktop(page);
await page.evaluate(async (session) => {
const handlers = window.__ipc.handlers;
handlers.debug_capabilities = () => ({});
handlers.debug_completions = () => [];
handlers.debug_scopes = () => [];
handlers.debug_evaluate_in = () => ({
name: "result",
value: "42",
typeName: "int",
variablesReference: 0,
evaluateName: null,
});
const statePath = "/src/features/debugger/state.ts";
const historyPath = "/src/features/debugger/ui/expressionHistory.ts";
const projectPath = "/src/platform/project.ts";
const servicesPath = "/src/workbench/contributions.ts";
const layoutPath = "/src/workbench/toolwindows/store.ts";
const { adoptSession } = await import(/* @vite-ignore */ statePath);
const { pushHistory } = await import(/* @vite-ignore */ historyPath);
const { useProject } = await import(/* @vite-ignore */ projectPath);
const { toolWindowService } = await import(/* @vite-ignore */ servicesPath);
const { moveToolWindow, setToolWindowSize } = await import(/* @vite-ignore */ layoutPath);
const settings = useProject.getState().settings;
useProject.setState({
settings: { ...settings, editor: { ...settings?.editor, fontFamily: "Consolas", fontSize: 18 } },
});
pushHistory("evaluate", "order.total + tax");
pushHistory("evaluate", "if ready:\n settle()");
adoptSession(session, { name: "Checkout", adapter: "debugpy", status: "paused", selectedFrame: 11 });
moveToolWindow("debug", "right");
setToolWindowSize("right", 285);
toolWindowService().show("debug", true);
}, SESSION);
const debug = page.getByRole("region", { name: "Debug", exact: true });
const variables = debug.getByRole("tab", { name: "Variables", exact: true });
if (await variables.isVisible()) await variables.click();
const field = debug.getByRole("textbox", { name: "Evaluate expression", exact: true });
const historyButton = debug.getByRole("button", { name: "History", exact: true });
const watch = debug.getByRole("button", { name: "Add to Watches", exact: true });
await expect(field).toBeVisible();
await expect(historyButton).toBeVisible();
await expect(field).toHaveAttribute("placeholder", "Evaluate expression");
await expect(field).toHaveCSS("font-family", /^"?Consolas"?,/);
await expect(field).toHaveCSS("font-size", "13px");
expect((await field.boundingBox())!.width).toBeGreaterThan(100);
expect((await watch.boundingBox())!.x).toBeLessThan((await historyButton.boundingBox())!.x);
await historyButton.click();
const menu = page.getByRole("menu", { name: "Expression history", exact: true });
await expect(menu.getByRole("menuitem")).toHaveText(["order.total + tax"]);
const row = (await field.locator("..").boundingBox())!;
const popup = (await menu.locator("..").boundingBox())!;
expect(popup.x).toBeCloseTo(row.x, 0);
expect(popup.width).toBeCloseTo(row.width, 0);
await page.keyboard.press("Escape");
await expect(menu).toBeHidden();
await expect(historyButton).toBeFocused();
await historyButton.press("Enter");
await menu.getByRole("menuitem", { name: "order.total + tax" }).press("Enter");
await expect(field).toBeFocused();
await expect(field).toHaveValue("order.total + tax");
await field.press("Enter");
await expect
.poll(() => ipcCalls(page, "debug_evaluate_in"))
.toContainEqual(expect.objectContaining({ expression: "order.total + tax", context: "repl" }));
await field.fill("order.total");
await watch.click();
await expect(field).toHaveValue("");
await expect
.poll(() => ipcCalls(page, "debug_evaluate_in"))
.toContainEqual(expect.objectContaining({ expression: "order.total", context: "watch" }));
await historyButton.click();
await expect(menu.getByRole("menuitem")).toHaveText(["order.total", "order.total + tax"]);
});
+85
Переглянути файл
@@ -444,3 +444,88 @@ test("the Paths filter replaces the repository filter and can be cleared from ov
await picker.getByRole("button", { name: "OK" }).click();
await expect(firstCommit.getByText("Commit 1", { exact: true })).toBeVisible();
});
test("the Git Log path tree resizes and keeps selected paths reachable in a short window", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1000, height: 720 });
const longName = "reconcile-invoices-and-export-the-complete-quarterly-settlement-audit.ts";
await page.evaluate(async (longName) => {
const logPath = "/src/features/vcs/logStore.ts";
const optionsPath = "/src/features/vcs/logOptions.ts";
const { setLogFilters } = await import(/* @vite-ignore */ logPath);
const { setLogOptions } = await import(/* @vite-ignore */ optionsPath);
const root = "/dev/acme-api";
const selected = Array.from({ length: 9 }, (_, i) => `entry-${i + 1}.ts`);
const entry = (name: string, kind: "dir" | "file") => ({
name,
path: `${root}/${name}`,
kind,
size: 0,
mtimeMs: 0,
});
window.__ipc.handlers.fs_read_dir = ({ path }) =>
path === root
? [entry("src", "dir"), entry(longName, "file"), ...selected.map((name) => entry(name, "file"))]
: [];
setLogOptions({ showBranches: false, showDetails: false });
setLogFilters({ paths: selected.map((name) => `${root}/${name}`) });
}, longName);
const toolbar = page.getByRole("toolbar", { name: "Log filters" });
const openTree = async () => {
await toolbar.getByRole("button", { name: "More Filters" }).click();
await page.getByRole("menuitem", { name: /^Paths:/ }).click();
await page.getByRole("menuitem", { name: "Select in Tree…" }).click();
};
await openTree();
const dialog = page.getByRole("dialog", { name: "Filter by Paths" });
const tree = dialog.getByRole("tree", { name: "Files and folders" });
const resize = dialog.locator('[class*="_resizeGrip_"]');
await expect(tree).toBeVisible();
await expect(resize).toBeVisible();
await tree.getByRole("treeitem", { name: "acme-api", exact: true }).locator("[data-tree-toggle]").click();
const folder = tree.getByRole("checkbox", { name: "src", exact: true });
const file = tree.getByRole("checkbox", { name: longName, exact: true });
await expect(folder.locator("xpath=ancestor::label").locator("svg")).toHaveCount(1);
const title = file.locator("xpath=ancestor::label").getByTitle(longName);
await expect(title).toHaveCSS("font-size", "13px");
await expect(title).toHaveCSS("text-overflow", "ellipsis");
const originalTreeHeight = (await tree.boundingBox())!.height;
const grip = (await resize.boundingBox())!;
const x = grip.x + grip.width / 2;
const y = grip.y + grip.height / 2;
await page.mouse.move(x, y);
await page.mouse.down();
await page.mouse.move(x + 30, y + 65, { steps: 5 });
await page.mouse.up();
await expect.poll(async () => (await tree.boundingBox())!.height).toBeGreaterThan(originalTreeHeight + 40);
await dialog.getByRole("button", { name: "Cancel" }).click();
await page.setViewportSize({ width: 420, height: 325 });
await openTree();
await tree.getByRole("treeitem", { name: "acme-api", exact: true }).locator("[data-tree-toggle]").click();
const selected = dialog.getByRole("group", { name: "Selected paths" });
await expect(selected).toBeVisible();
await expect.poll(() => selected.evaluate((node) => node.scrollHeight - node.clientHeight)).toBeGreaterThan(1);
await expect
.poll(() => dialog.locator("[data-dialog-body]").evaluate((node) => node.scrollHeight - node.clientHeight))
.toBeLessThanOrEqual(1);
await expect.poll(() => title.evaluate((node) => node.scrollWidth - node.clientWidth)).toBeGreaterThan(1);
const removed = selected.getByRole("checkbox", { name: "acme-api/entry-9.ts", exact: true });
await removed.click();
await expect(removed).toHaveCount(0);
await file.check();
await expect(selected.getByRole("checkbox", { name: `acme-api/${longName}`, exact: true })).toBeChecked();
await expect(dialog.getByRole("button", { name: "OK" })).toBeInViewport({ ratio: 1 });
await dialog.getByRole("button", { name: "OK" }).click();
await expect(dialog).toBeHidden();
const applied = await page.evaluate(async () => {
const path = "/src/features/vcs/logStore.ts";
const { useGitLog } = await import(/* @vite-ignore */ path);
return useGitLog.getState().filters.paths;
});
expect(applied).toContain(`/dev/acme-api/${longName}`);
expect(applied).not.toContain("/dev/acme-api/entry-9.ts");
});
+63
Переглянути файл
@@ -0,0 +1,63 @@
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
const prefix = "reconcile-regional-inventory-and-rebuild-order-settlement-cache-for-warehouse-";
const east = prefix + "east-stage";
const west = prefix + "west-stage";
const content = JSON.stringify(
{ name: "warehouse-tools", scripts: { [east]: "node east.js", [west]: "node west.js", build: "node build.js" } },
null,
2,
);
test("the npm gutter keeps distinct ends of long names and runs the selected script", async ({ workbench: page }) => {
await page.setViewportSize({ width: 440, height: 520 });
await stubDesktop(page);
await page.evaluate(async (text) => {
const backendPath = "/src/editor/core/backend.ts";
const servicePath = "/src/workbench/contributions.ts";
const { docBackend } = await import(/* @vite-ignore */ backendPath);
const { editorService } = await import(/* @vite-ignore */ servicePath);
const path = "/dev/acme-api/package.json";
docBackend().files.set(path, text);
const handlers = window.__ipc.handlers;
handlers.fs_probe = () => ({ size: text.length, binary: false, tooLarge: false });
handlers.fs_read_text = ({ path }) => docBackend().files.get(String(path)) ?? "";
handlers.fs_read_dir = () => [];
handlers.run_configs = () => [];
handlers.run_start = ({ config }) => ({
id: 7,
configId: (config as { id: string }).id,
name: (config as { name: string }).name,
pid: 4242,
running: true,
pty: false,
});
await editorService().openFile(path);
}, content);
const editor = page.locator(".cm-editor");
const menu = page.getByRole("menu", { name: "Context menu" });
for (const name of [east, west]) {
await editor.getByTitle("Run '" + name + "'", { exact: true }).click();
const label = "Run 'npm run " + name + "'";
const run = menu.getByRole("menuitem", { name: label, exact: true });
const end = run.getByText(label.slice(-12), { exact: true });
await expect(end).toBeVisible();
await expect(end.locator("..")).toHaveAttribute("title", label);
expect(await end.evaluate((node) => node.clientWidth >= node.scrollWidth)).toBe(true);
const start = end.locator("..").locator(":scope > span").first();
expect(await start.evaluate((node) => node.clientWidth < node.scrollWidth)).toBe(true);
await expect(start).toHaveCSS("text-overflow", "ellipsis");
const titleUnderPointer = await start.evaluate((node) => {
const { x, y, width, height } = node.getBoundingClientRect();
return document.elementFromPoint(x + width / 2, y + height / 2)?.getAttribute("title");
});
expect(titleUnderPointer).toBe(label);
await expect(run).toBeFocused();
if (name === east) await run.press("Escape");
else await run.press("Enter");
await expect(menu).toBeHidden();
}
await expect
.poll(async () => ipcCalls(page, "run_start"))
.toMatchObject([{ config: { args: ["run", west], kind: "npm" } }]);
});
+1 -1
Переглянути файл
@@ -293,7 +293,7 @@ describe("debug tool window", () => {
expect(screen.getByRole("tab", { name: "Threads & Variables" })).toBeTruthy();
expect(screen.getByRole("tab", { name: "Console" })).toBeTruthy();
expect(screen.getByRole("option", { selected: true })).toHaveTextContent("main:12, main.py");
expect(screen.getByPlaceholderText("Evaluate expression (↩) or add a watch (⇧⌘↩)")).toBeTruthy();
expect(screen.getByRole("textbox", { name: "Evaluate expression" })).toBeTruthy();
expect(await screen.findByText("{int}")).toBeTruthy();
expect(screen.getByText("'hi'")).toBeTruthy();
// A multi-line rendering stays on its row.
+16 -2
Переглянути файл
@@ -210,14 +210,28 @@
}
.evalField {
height: 30px;
min-height: var(--h-field);
flex: none;
display: flex;
align-items: center;
gap: var(--space-1);
padding: 0 4px 0 12px;
padding: var(--space-0-5) var(--space-1) var(--space-0-5) var(--space-2);
background: var(--bg-input);
border-bottom: 1px solid var(--border);
}
.evalField:focus-within {
box-shadow: inset 0 -1px var(--focus-ring);
}
.evalField > button {
flex: none;
}
.evalField .evalInput {
padding: 0;
}
.evalHistory {
padding-block: var(--space-1);
overflow-x: hidden;
}
.repl {
height: 28px;
+81 -10
Переглянути файл
@@ -3,6 +3,10 @@ import { writeClipboardText } from "@/platform/clipboard";
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from "react";
import clsx from "clsx";
import { executeAction } from "@/platform/actions";
import { editorPrefs } from "@/platform/editorSettings";
import { monoFontFamily } from "@/platform/fonts";
import { isImeKey } from "@/platform/ime";
import { formatBinding, hostBinding } from "@/platform/keymap";
import { basename, useProject } from "@/platform/project";
import { call, commands, isTauri, type Scope, type Variable } from "@/platform/ipc";
import {
@@ -11,6 +15,8 @@ import {
IconButton,
Kbd,
Menu,
MenuList,
Popup,
Select,
SplitGroup,
SplitHandle,
@@ -54,6 +60,7 @@ import { MemoryView } from "../memory/MemoryView";
import { DebugConsole } from "./DebugConsole";
import { VariablesView, type VarRoot } from "./VariablesView";
import { useExpressionCompletion } from "./ExpressionCompletion";
import { pushHistory, readHistory } from "./expressionHistory";
import { sortVariables } from "../values";
import { workflowSettings } from "@/platform/workflowSettings";
import { useToolWindowShown } from "@/workbench/contributions";
@@ -555,9 +562,12 @@ function VariablesPane({ session }: { session: DebugSession }) {
const watches = useDebug((s) => s.watches);
const stopSeq = useDebug((s) => s.stopSeq);
const variablesEpoch = useDebug((s) => s.variablesEpoch);
const settings = useProject((s) => s.settings);
const [expression, setExpression] = useState("");
const evalField = useRef<HTMLInputElement>(null);
const evalRow = useRef<HTMLDivElement>(null);
const completion = useExpressionCompletion(evalField, expression, setExpression, session);
const [history, setHistory] = useState<{ sessionId: number; stopSeq: number; entries: string[] } | null>(null);
const [lastEval, setLastEval] = useState<EvalRow | null>(null);
const [scopeData, setScopeData] = useState<{ frame: number | null; scopes: Scope[]; locals: Variable[] }>({
frame: null,
@@ -570,6 +580,8 @@ function VariablesPane({ session }: { session: DebugSession }) {
rows: [],
});
const frame = session.status === "paused" ? session.selectedFrame : null;
const historyOpen = frame != null && history?.sessionId === session.id && history.stopSeq === stopSeq;
const editor = settings?.editor;
const live = liveWatchesApply(session);
// A hidden tool window stays mounted: its watches must not go on running in the page.
const liveWatches = useLiveWatches(session, watches, useToolWindowShown());
@@ -676,6 +688,7 @@ function VariablesPane({ session }: { session: DebugSession }) {
const run = async () => {
const e = expression.trim();
if (!e) return;
pushHistory("evaluate", e);
try {
setLastEval({
expression: e,
@@ -687,12 +700,32 @@ function VariablesPane({ session }: { session: DebugSession }) {
}
};
const addExpressionWatch = () => {
const e = expression.trim();
if (!e) return;
pushHistory("evaluate", e);
addWatch(e);
setExpression("");
};
const recall = (text: string) => {
setExpression(text);
requestAnimationFrame(() => {
evalField.current?.focus();
evalField.current?.setSelectionRange(text.length, text.length);
});
};
return (
<div className={styles.variables}>
<div className={styles.evalField}>
<div ref={evalRow} className={styles.evalField}>
<input
ref={evalField}
className={styles.evalInput}
style={{
fontFamily: monoFontFamily(editor?.fontFamily, editorPrefs(settings).fallbackFont, "var(--font-mono)"),
fontSize: editor?.fontSize ? `min(var(--fs-ui), ${editor.fontSize}px)` : undefined,
}}
value={expression}
onChange={(e) => {
setExpression(e.target.value);
@@ -700,17 +733,16 @@ function VariablesPane({ session }: { session: DebugSession }) {
}}
onBlur={completion.close}
onKeyDown={(e) => {
if (completion.onKeyDown(e)) return;
if (isImeKey(e.nativeEvent) || completion.onKeyDown(e)) return;
if (e.key === "Enter" && (e.metaKey || e.ctrlKey) && e.shiftKey) {
e.preventDefault();
addWatch(expression);
setExpression("");
addExpressionWatch();
} else if (e.key === "Enter") {
e.preventDefault();
void run();
}
}}
placeholder={frame != null ? "Evaluate expression (↩) or add a watch (⇧⌘↩)" : "Evaluate expression"}
placeholder={tx("Evaluate expression")}
aria-label={tx("Evaluate expression")}
spellCheck={false}
autoComplete="off"
@@ -720,16 +752,55 @@ function VariablesPane({ session }: { session: DebugSession }) {
<IconButton
icon="plus"
title="Add to Watches"
shortcut="⇧⌘↩"
shortcut={formatBinding(hostBinding("Meta+Shift+Enter"))}
size="small"
iconSize={16}
disabled={!expression.trim()}
onClick={() => {
addWatch(expression);
setExpression("");
}}
onClick={addExpressionWatch}
/>
<IconButton
icon="chevron-down"
title="History"
size="small"
aria-haspopup="menu"
aria-expanded={historyOpen}
disabled={frame == null}
onClick={() =>
setHistory(
historyOpen
? null
: {
sessionId: session.id,
stopSeq,
entries: readHistory("evaluate")
.filter((entry) => !/[\r\n]/.test(entry))
.slice(0, 20),
},
)
}
/>
</div>
<Popup
open={historyOpen}
onClose={() => setHistory(null)}
anchor={evalRow}
placement="bottom-start"
matchWidth
role="presentation"
autoFocus={false}
className={styles.evalHistory}
>
<MenuList
aria-label={tx("Expression history")}
iconColumn={false}
onDone={() => setHistory(null)}
items={
history?.entries.length
? history.entries.map((entry) => ({ label: entry, verbatim: true, run: () => recall(entry) }))
: [{ label: "No history", disabled: true }]
}
/>
</Popup>
{frame == null && !watches.length && !lastEval ? (
<div className={styles.note}>
{session.status === "terminated"
+1
Переглянути файл
@@ -262,6 +262,7 @@ export function choiceItems(choices: readonly Produced[], debug: boolean): MenuI
{ kind: "header", label: debug ? "Choose configuration to debug" : "Choose configuration to run" },
...choices.map((p): MenuItem => ({
label: debug ? tx`Debug '${p.name}'` : tx`Run '${p.name}'`,
preserveLabelEnd: true,
verbatim: true,
icon: debug ? "debug" : "run",
shortcut: p.detail,
+2
Переглянути файл
@@ -82,6 +82,7 @@ async function profileMenu(entry: ScriptEntry, path: string): Promise<MenuItem[]
return [
{
label: tx`Run '${config.name}'`,
preserveLabelEnd: true,
icon: "run",
shortcut: shortcutLabel("run.runContext"),
run: () =>
@@ -91,6 +92,7 @@ async function profileMenu(entry: ScriptEntry, path: string): Promise<MenuItem[]
},
{
label: tx`Debug '${config.name}'`,
preserveLabelEnd: true,
icon: "debug",
shortcut: shortcutLabel("run.debugContext"),
run: () => void executeAction("run.debugConfig", config),
+2
Переглянути файл
@@ -283,6 +283,7 @@ export async function scriptMenuItems(entry: ScriptEntry, path: string, content:
return [
{
label: tx`Run '${label}'`,
preserveLabelEnd: true,
icon: "run",
shortcut: shortcutLabel("run.runContext"),
run: () =>
@@ -292,6 +293,7 @@ export async function scriptMenuItems(entry: ScriptEntry, path: string, content:
},
{
label: tx`Debug '${label}'`,
preserveLabelEnd: true,
icon: "debug",
shortcut: shortcutLabel("run.debugContext"),
run: () => void executeAction("run.debugConfig", config),
+8 -1
Переглянути файл
@@ -109,11 +109,18 @@ export function targetMenuItems(target: RunTarget, path: string, content: string
: { run: () => void launch(target, path, debug, content) };
const debuggable = !p || canDebugProduced(p);
return [
{ label: tx`Run '${name}'`, icon: "run", shortcut: shortcutLabel("run.runContext"), ...pick(false) } as MenuItem,
{
label: tx`Run '${name}'`,
preserveLabelEnd: true,
icon: "run",
shortcut: shortcutLabel("run.runContext"),
...pick(false),
} as MenuItem,
...(debuggable
? [
{
label: tx`Debug '${name}'`,
preserveLabelEnd: true,
icon: "debug",
shortcut: shortcutLabel("run.debugContext"),
...pick(true),
+70
Переглянути файл
@@ -0,0 +1,70 @@
.chooser > [data-dialog-body] {
display: flex;
overflow: hidden;
}
.content {
display: flex;
flex: 1;
flex-direction: column;
min-width: 0;
min-height: 0;
gap: var(--space-2);
padding: var(--space-2) var(--space-4) 0;
font-size: var(--fs-ui);
}
.tree {
flex: 1;
min-height: 0;
border: 1px solid var(--border);
border-radius: var(--radius-small);
background: var(--bg-input);
overflow: hidden;
}
.choice {
flex: 1;
min-width: 0;
}
.entry {
display: flex;
align-items: center;
gap: var(--space-1);
min-width: 0;
}
.entry svg {
flex: none;
}
.path {
display: block;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.selected {
display: flex;
flex-direction: column;
flex: 0 1 auto;
min-height: 0;
max-height: min(96px, 33%);
padding-inline: var(--space-2);
overflow: auto;
}
.selected .choice {
flex: none;
min-height: var(--h-list-row);
}
.error {
max-height: 25%;
overflow: auto;
overflow-wrap: anywhere;
color: var(--danger);
}
+49 -14
Переглянути файл
@@ -1,5 +1,5 @@
import { useState } from "react";
import { Checkbox, Dialog, SearchField, Tree } from "@/ui";
import { Checkbox, Dialog, Icon, SearchField, Tree, fileIconName } from "@/ui";
import { projectFs } from "@/features/project-tree/fs";
import { openDialog } from "./dialogs";
import { dirName, relTo, stripSlash } from "./model";
@@ -7,6 +7,7 @@ import { repoName, repoOf } from "./store";
import { call, commands } from "@/platform/ipc";
import { tx } from "@/platform/i18n";
import { ipcPath, isSameOrInside } from "@/platform/paths";
import styles from "./PathFilterDialog.module.css";
interface PathNode {
path: string;
@@ -167,15 +168,21 @@ function PathFilterDialog({
<Dialog
open
title="Filter by Paths"
width={560}
className={styles.chooser}
width={432}
initialSize={{ w: 432, h: 392 }}
resizable="both"
minWidth={300}
minHeight={220}
onClose={() => onDone(null)}
buttons={[
{ label: "OK", role: "default", onClick: () => onDone([...checked]) },
{ label: "Cancel", role: "cancel" },
]}
>
<div style={{ height: 320 }}>
<div className={styles.content}>
<Tree<PathNode>
className={styles.tree}
roots={nodes}
getKey={(n) => n.path}
getLabel={(n) => n.name}
@@ -183,21 +190,49 @@ function PathFilterDialog({
isExpandable={(n) => n.directory}
loadChildren={load}
renderNode={(n) => (
<Checkbox label={n.name} checked={checked.has(n.path)} onChange={(on) => toggle(n.path, on)} />
<Checkbox
className={styles.choice}
label={
<span className={styles.entry}>
<Icon name={n.directory ? "folder" : fileIconName(n.name, n.path)} size={16} />
<span className={styles.path} title={n.name}>
{n.name}
</span>
</span>
}
checked={checked.has(n.path)}
onChange={(on) => toggle(n.path, on)}
/>
)}
aria-label="Files and folders"
/>
{checked.size > 0 && (
<div className={styles.selected} role="group" aria-label={tx("Selected paths")}>
{[...checked].map((path) => {
const root = roots.includes(path) ? path : repoOf(path, roots);
const label = root ? (path === root ? repoName(root) : `${repoName(root)}/${relTo(root, path)}`) : path;
return (
<Checkbox
key={path}
className={styles.choice}
label={
<span className={styles.path} title={label}>
{label}
</span>
}
checked
onChange={(on) => toggle(path, on)}
/>
);
})}
</div>
)}
{error && (
<div className={styles.error} role="alert">
{error}
</div>
)}
</div>
{checked.size > 0 && (
<div style={{ maxHeight: 100, overflow: "auto" }} aria-label="Selected paths">
{[...checked].map((path) => {
const root = roots.includes(path) ? path : repoOf(path, roots);
const label = root ? (path === root ? repoName(root) : `${repoName(root)}/${relTo(root, path)}`) : path;
return <Checkbox key={path} label={label} checked onChange={(on) => toggle(path, on)} />;
})}
</div>
)}
{error && <div role="alert">{error}</div>}
</Dialog>
);
}
+1 -3
Переглянути файл
@@ -625,9 +625,6 @@
"Folded unchanged fragments › Wave": "Folded unchanged fragments › Wave",
"Error stripe mark": "Error stripe mark",
"Dock Pinned": "Dock Pinned",
"Move More Tool Windows Button": "Move More Tool Windows Button",
"Move to Right": "Move to Right",
"Move to Left": "Move to Left",
"Dock Unpinned": "Dock Unpinned",
"Undock": "Undock",
"The program ended by itself, so no garbage collection ran before the profile was written: objects that were already unreachable may show as live.": "The program ended by itself, so no garbage collection ran before the profile was written: objects that were already unreachable may show as live.",
@@ -840,6 +837,7 @@
"Unknown error": "Unknown error",
"Retry Loading Conversation": "Retry Loading Conversation",
"No conversation history": "No conversation history",
"No history": "No history",
"Loading the conversation timed out. Try again.": "Loading the conversation timed out. Try again.",
"Couldn't load the conversation: {0}": "Couldn't load the conversation: {0}",
"Astro Language Server": "Astro Language Server",
-1
Переглянути файл
@@ -782,7 +782,6 @@
"Evaluate": "Evaluar",
"Evaluate Expression…": "Evaluar expresión…",
"Evaluate expression": "Evaluar expresión",
"Evaluate expression (↩) or add a watch (⇧⌘↩)": "Evaluar expresión (↩) o agregar una expresión de inspección (⇧⌘↩)",
"Evaluate in the debug console": "Evaluar en la consola de depuración",
"Evaluation result": "Resultado de la evaluación",
"Everything is up to date": "Todo está actualizado",
-1
Переглянути файл
@@ -719,7 +719,6 @@
"Evaluate": "Évaluer",
"Evaluate Expression…": "Évaluer l'expression…",
"Evaluate expression": "Évaluer l'expression",
"Evaluate expression (↩) or add a watch (⇧⌘↩)": "Évaluer l'expression (↩) ou ajouter une expression surveillée (⇧⌘↩)",
"Evaluate in the debug console": "Évaluer dans la console de débogage",
"Evaluation result": "Résultat de l'évaluation",
"Everything is up to date": "Tout est à jour",
-1
Переглянути файл
@@ -818,7 +818,6 @@
"Evaluate": "평가",
"Evaluate Expression…": "표현식 평가…",
"Evaluate expression": "표현식 평가",
"Evaluate expression (↩) or add a watch (⇧⌘↩)": "표현식 평가(↩) 또는 watch 추가(⇧⌘↩)",
"Evaluate in the debug console": "디버그 콘솔에서 평가",
"Evaluation result": "평가 결과",
"Everything is up to date": "모두 최신 상태입니다",
-1
Переглянути файл
@@ -774,7 +774,6 @@
"Evaluate": "Oblicz/Ewaluuj",
"Evaluate Expression…": "Oblicz wyrażenie…",
"Evaluate expression": "Oblicz wyrażenie",
"Evaluate expression (↩) or add a watch (⇧⌘↩)": "Oblicz wyrażenie (↩) lub dodaj do obserwowanych (⇧⌘↩)",
"Evaluate in the debug console": "Oblicz w konsoli debugowania",
"Evaluation result": "Wynik obliczenia",
"Everything is up to date": "Wszystko jest aktualne",
-1
Переглянути файл
@@ -774,7 +774,6 @@
"Evaluate": "Avaliar",
"Evaluate Expression…": "Avaliar expressão…",
"Evaluate expression": "Avaliar expressão",
"Evaluate expression (↩) or add a watch (⇧⌘↩)": "Avaliar expressão (↩) ou adicionar inspeção (⇧⌘↩)",
"Evaluate in the debug console": "Avaliar no console de depuração",
"Evaluation result": "Resultado da avaliação",
"Everything is up to date": "Tudo está atualizado",
-1
Переглянути файл
@@ -3570,7 +3570,6 @@
"Evaluate": "Değerlendir",
"Evaluate Expression…": "İfadeyi Değerlendir…",
"Evaluate expression": "İfadeyi değerlendir",
"Evaluate expression (↩) or add a watch (⇧⌘↩)": "İfadeyi değerlendir (↩) veya izleme ekle (⇧⌘↩)",
"Evaluate in the debug console": "Hata ayıklama konsolunda değerlendir",
"Evaluation result": "Değerlendirme sonucu",
"Everything is up to date": "Her şey güncel",
-1
Переглянути файл
@@ -1438,7 +1438,6 @@
"Evaluate": "計算",
"Evaluate Expression…": "計算表示式…",
"Evaluate expression": "計算表示式",
"Evaluate expression (↩) or add a watch (⇧⌘↩)": "計算表示式 (↩) 或新增監視 (⇧⌘↩)",
"Evaluate in the debug console": "在偵錯主控台中計算",
"Evaluation result": "計算結果",
"Everything is up to date": "一切都是最新的",
-2
Переглянути файл
@@ -1777,7 +1777,6 @@
"Evaluate": "计算",
"Evaluate Expression…": "计算表达式…",
"Evaluate expression": "计算表达式",
"Evaluate expression (↩) or add a watch (⇧⌘↩)": "计算表达式 (↩) 或添加监视 (⇧⌘↩)",
"Evaluate in the debug console": "在调试控制台中计算",
"Evaluation result": "计算结果",
"Everything is up to date": "一切都是最新的",
@@ -2276,7 +2275,6 @@
"More Actions": "更多操作",
"More Run/Debug": "更多运行/调试",
"More Tool Windows": "更多工具窗口",
"Move More Tool Windows Button": "移动“更多工具窗口”按钮",
"Most recently opened tab": "最近打开的标签页",
"Mouse Control": "鼠标控制",
"Mouse reporting": "鼠标报告",
+14
Переглянути файл
@@ -79,6 +79,20 @@
overflow: hidden;
text-overflow: ellipsis;
}
.splitLabel {
display: flex;
}
.labelStart,
.labelEnd {
min-width: 0;
overflow: hidden;
pointer-events: none;
text-overflow: ellipsis;
}
.labelEnd {
flex: none;
max-width: 50%;
}
.shortcut {
min-width: 0;
max-width: 50%;
+15 -2
Переглянути файл
@@ -43,6 +43,8 @@ export type MenuItem =
label: string;
/** User text (e.g. a past query): shown as is, never looked up in the catalog. */
verbatim?: boolean;
/** Keep the end of a long label visible when the menu has to truncate it. */
preserveLabelEnd?: boolean;
icon?: IconName | (string & {});
shortcut?: string;
disabled?: boolean;
@@ -67,6 +69,7 @@ interface Resolved {
kind: "item" | "separator" | "header" | "title";
key: string;
label: string;
preserveLabelEnd?: boolean;
icon?: string;
shortcut?: string;
disabled?: boolean;
@@ -387,6 +390,8 @@ export function MenuList({
</div>
);
const hasSub = !!r.submenu;
const characters = r.preserveLabelEnd ? Array.from(r.label) : [];
const split = characters.length > 24 ? characters.length - 12 : 0;
return (
<Fragment key={r.key}>
<button
@@ -395,6 +400,7 @@ export function MenuList({
}}
type="button"
role={r.checked !== undefined ? "menuitemcheckbox" : "menuitem"}
aria-label={split ? r.label : undefined}
aria-checked={r.checked}
aria-current={r.current || undefined}
aria-disabled={r.disabled || undefined}
@@ -427,8 +433,15 @@ export function MenuList({
{r.checked ? <Icon name="check" size={13} /> : r.icon ? <Icon name={r.icon} size={14} /> : null}
</span>
)}
<span className={styles.label} title={r.hint ? undefined : r.label}>
{r.label}
<span className={clsx(styles.label, split > 0 && styles.splitLabel)} title={r.hint ? undefined : r.label}>
{split ? (
<>
<span className={styles.labelStart}>{characters.slice(0, split).join("")}</span>
<span className={styles.labelEnd}>{characters.slice(split).join("")}</span>
</>
) : (
r.label
)}
</span>
{r.shortcut && (
<span className={styles.shortcut} title={r.shortcut}>
+1 -51
Переглянути файл
@@ -1,9 +1,8 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { act, fireEvent, render, screen, within } from "@testing-library/react";
import { act, fireEvent, render, screen } from "@testing-library/react";
import { emitLocalIdeEvent } from "@/platform/ipc";
import { setLocale } from "@/platform/i18n";
import { useProject } from "@/platform/project";
import { ContextMenuHost, hideContextMenu } from "@/ui/Menu";
import { registerStatusItem, registerToolWindow, type StatusItemContribution } from "./contributions";
import { orderStatusItems, StatusBar, TaskStatus } from "./StatusBar";
import { orderTitleItems } from "./TitleBar";
@@ -19,7 +18,6 @@ import {
} from "./notificationStore";
import { installTaskEvents, useTasks } from "./tasks";
import { ToolWindowLayout, ToolWindowStripe } from "./toolwindows/ToolWindows";
import { installToolWindowActions } from "./toolwindows/actions";
import {
isToolWindowVisible,
loadToolWindowLayout,
@@ -279,54 +277,6 @@ describe("notifications", () => {
});
describe("tool window stripe", () => {
it("moves More Tool Windows to an empty right stripe and back", () => {
const disposeActions = installToolWindowActions();
const disposeWindow = registerToolWindow({
id: "hidden-tool",
title: "Hidden Tool",
icon: "folder",
anchor: "left",
stripe: "onUse",
requiresProject: false,
component: () => null,
});
loadToolWindowLayout("/stripe-more");
const { unmount } = render(
<>
<ToolWindowLayout editor={null} />
<ContextMenuHost />
</>,
);
const button = () => screen.getByRole("button", { name: "More Tool Windows" });
const move = (label: string) => {
fireEvent.contextMenu(button());
fireEvent.click(screen.getByRole("menuitem", { name: label }));
};
try {
expect(button().closest("[data-stripe-side]")).toHaveAttribute("data-stripe-side", "left");
expect(screen.queryByRole("toolbar", { name: "Right tool windows" })).not.toBeInTheDocument();
move("Move to Right");
expect(button().closest("[data-stripe-side]")).toHaveAttribute("data-stripe-side", "right");
expect(screen.queryByRole("toolbar", { name: "Tool windows" })).not.toBeInTheDocument();
fireEvent.click(button());
const menu = screen.getByRole("menu", { name: "Tool windows" });
fireEvent.click(within(menu).getByRole("menuitem", { name: "Hidden Tool" }));
expect(isToolWindowVisible("hidden-tool")).toBe(true);
expect(screen.getByRole("button", { name: "Hidden Tool" }).closest("[data-stripe-side]")).toHaveAttribute(
"data-stripe-side",
"left",
);
move("Move to Left");
expect(button().closest("[data-stripe-side]")).toHaveAttribute("data-stripe-side", "left");
expect(screen.queryByRole("toolbar", { name: "Right tool windows" })).not.toBeInTheDocument();
} finally {
unmount();
hideContextMenu();
disposeWindow();
disposeActions();
}
});
it("renders left + bottom windows on the left stripe and toggles on click", () => {
const C = () => null;
const disposers = [
+63 -34
Переглянути файл
@@ -61,7 +61,6 @@ import {
type ToolWindowViewMode,
} from "./store";
import { contentTabRegistry } from "./content";
import { resetStripeNames, setStripe, STRIPE_MAX, STRIPE_MIN, useStripes, type StripeSide } from "./stripes";
import { toolWindowTitle } from "./title";
import styles from "./ToolWindows.module.css";
import { tx, useI18n } from "@/platform/i18n";
@@ -189,6 +188,53 @@ async function setShowToolWindowNames(on: boolean) {
useProject.setState({ settings });
}
/** Stripe button widths with names; icons only follow `--stripe-icon-button` (smaller in compact mode). */
const STRIPE_MIN = 44;
const STRIPE_DEFAULT = 56;
const STRIPE_MAX = 96;
const STRIPE_KEY = "openidea.stripes.v1";
type StripeSide = "left" | "right";
/** Per stripe: button width with names, and names shown or hidden by a drag (unset: the setting decides). */
interface StripeSize {
width: number;
names?: boolean;
}
function readStripes(): Record<StripeSide, StripeSize> {
const out: Record<StripeSide, StripeSize> = { left: { width: STRIPE_DEFAULT }, right: { width: STRIPE_DEFAULT } };
try {
const raw = JSON.parse(localStorage.getItem(STRIPE_KEY) ?? "null");
for (const side of ["left", "right"] as const) {
const v = raw?.[side];
if (typeof v?.width === "number") out[side].width = Math.min(STRIPE_MAX, Math.max(STRIPE_MIN, v.width));
if (typeof v?.names === "boolean") out[side].names = v.names;
}
} catch {
/* storage unavailable */
}
return out;
}
const useStripes = create<Record<StripeSide, StripeSize>>(readStripes);
function setStripe(side: StripeSide, size: StripeSize) {
useStripes.setState({ [side]: size });
try {
localStorage.setItem(STRIPE_KEY, JSON.stringify(useStripes.getState()));
} catch {
/* storage unavailable */
}
}
/** "Show Tool Window Names" (menu or settings) applies to both stripes again. */
function resetStripeNames() {
const s = useStripes.getState();
if (s.left.names === undefined && s.right.names === undefined) return;
setStripe("left", { width: s.left.width });
setStripe("right", { width: s.right.width });
}
/**
* Resize handle on a stripe's inner edge. Dragging sets the stripe's button width;
* narrower than halfway to the named minimum shows icons only.
@@ -438,7 +484,7 @@ function StripeButton({
}
/** Stripe "…": tool windows without a stripe button; opening one adds its button (IDEA). */
function StripeMore({ side, windows }: { side: StripeSide; windows: ToolWindowContribution[] }) {
function StripeMore({ windows }: { windows: ToolWindowContribution[] }) {
const iconSize = useChromeIconSize();
const [open, setOpen] = useState(false);
const ref = useRef<HTMLButtonElement>(null);
@@ -466,18 +512,7 @@ function StripeMore({ side, windows }: { side: StripeSide; windows: ToolWindowCo
aria-haspopup="menu"
aria-expanded={open}
onClick={() => setOpen((v) => !v)}
onContextMenu={(e) => {
e.preventDefault();
setOpen(false);
showContextMenu(e, [
{
kind: "action",
action: "toolwindow.moveMore",
label: side === "left" ? "Move to Right" : "Move to Left",
},
]);
}}
data-tooltip-stripe={side}
data-tooltip-stripe="left"
{...tooltipAttrs("More Tool Windows")}
>
<Icon name="more-horizontal" size={iconSize} />
@@ -487,7 +522,7 @@ function StripeMore({ side, windows }: { side: StripeSide; windows: ToolWindowCo
onClose={() => setOpen(false)}
anchor={ref}
items={items}
placement={side === "left" ? "right-start" : "left-start"}
placement="right-start"
aria-label="Tool windows"
/>
</>
@@ -525,7 +560,6 @@ export function ToolWindowStripe({
const primary = inSlot(side);
const split = inSlot(`${side}-split`);
const lower = inSlot(lowerSlot(side));
const moreSide = useStripes((s) => s.moreSide);
const moreWindows = windows.filter((w) => !onStripe.includes(w));
const focused = useToolWindowLayout((s) => s.focused);
const drop = useStripeDrag((s) => s.drop);
@@ -565,7 +599,7 @@ export function ToolWindowStripe({
{renderGroup(side, primary)}
{dragging && <div className={styles.stripeSeparator} data-stripe-separator="" role="separator" />}
{(split.length > 0 || dragging) && renderGroup(`${side}-split`, split)}
{side === moreSide && <StripeMore side={side} windows={moreWindows} />}
{side === "left" && <StripeMore windows={moreWindows} />}
<div className={styles.stripeSpacer} data-stripe-spacer="" />
{renderGroup(lowerSlot(side), lower)}
</nav>
@@ -1281,21 +1315,16 @@ export function ToolWindowLayout({ editor }: { editor: ReactNode }) {
);
const sizes = useToolWindowLayout((s) => s.sizes);
const stripeButtons = useToolWindowLayout((s) => s.stripeButtons);
// Keep the overflow button reachable and show empty stripes as drop targets while dragging.
// The right stripe holds the right side's windows and Bottom Right.
const hasRight = windows.some((w) => {
const slot = slotOf(w);
return (
(w.anchor === "right" || slot === "bottom-split") && (hasStripeButton(w, stripeButtons) || visible[slot] === w.id)
);
});
// While a stripe button is dragged, an empty right stripe shows as a drop target.
const dragging = useStripeDrag((s) => !!s.id);
const showStripe = (side: StripeSide) =>
bars &&
(stripes.moreSide === side ||
dragging ||
windows.some((w) => {
const slot = slotOf(w);
return (
(w.anchor === side || slot === lowerSlot(side)) &&
(hasStripeButton(w, stripeButtons) || visible[slot] === w.id)
);
}));
const leftStripe = showStripe("left");
const rightStripe = showStripe("right");
const rightStripe = bars && (hasRight || dragging);
const gridRef = useRef<HTMLDivElement>(null);
const editorRef = useRef<HTMLDivElement>(null);
// Undocked windows take no track: the editor keeps its size under them.
@@ -1328,10 +1357,10 @@ export function ToolWindowLayout({ editor }: { editor: ReactNode }) {
return (
<div
ref={frameRef}
className={clsx(styles.frame, !rightStripe && styles.frameNoRight, !leftStripe && styles.frameNoLeft)}
className={clsx(styles.frame, !rightStripe && styles.frameNoRight, !bars && styles.frameNoLeft)}
>
{leftStripe && stripe("left")}
{leftStripe && stripeHandle("left")}
{bars && stripe("left")}
{bars && stripeHandle("left")}
<div
ref={gridRef}
className={clsx(styles.grid, widescreen && styles.widescreen)}
-7
Переглянути файл
@@ -18,7 +18,6 @@ import {
useToolWindowLayouts,
} from "./layouts";
import { closeSelectedContent } from "./content";
import { toggleMoreToolWindowsSide } from "./stripes";
import {
activateToolWindow,
hideActiveToolWindow,
@@ -218,12 +217,6 @@ export function installToolWindowActions(): () => void {
};
const disposeStatic = registerActions([
{
id: "toolwindow.moveMore",
title: "Move More Tool Windows Button",
category: "Window",
run: toggleMoreToolWindowsSide,
},
{
id: "toolwindow.hideAll",
title: "Hide All Tool Windows",
-61
Переглянути файл
@@ -1,61 +0,0 @@
import { create } from "zustand";
export type StripeSide = "left" | "right";
/** Stripe button widths with names; icons only follow `--stripe-icon-button`. */
export const STRIPE_MIN = 44;
export const STRIPE_MAX = 96;
const STRIPE_DEFAULT = 56;
const STRIPE_KEY = "openidea.stripes.v1";
interface StripeSize {
width: number;
/** Names shown or hidden by a resize. Unset follows the appearance setting. */
names?: boolean;
}
interface Stripes extends Record<StripeSide, StripeSize> {
moreSide: StripeSide;
}
function readStripes(): Stripes {
const out: Stripes = { left: { width: STRIPE_DEFAULT }, right: { width: STRIPE_DEFAULT }, moreSide: "left" };
try {
const raw = JSON.parse(localStorage.getItem(STRIPE_KEY) ?? "null");
for (const side of ["left", "right"] as const) {
const v = raw?.[side];
if (typeof v?.width === "number") out[side].width = Math.min(STRIPE_MAX, Math.max(STRIPE_MIN, v.width));
if (typeof v?.names === "boolean") out[side].names = v.names;
}
if (raw?.moreSide === "right") out.moreSide = "right";
} catch {
/* storage unavailable */
}
return out;
}
export const useStripes = create<Stripes>(readStripes);
function saveStripes(next: Partial<Stripes>) {
useStripes.setState(next);
try {
localStorage.setItem(STRIPE_KEY, JSON.stringify(useStripes.getState()));
} catch {
/* storage unavailable */
}
}
export function setStripe(side: StripeSide, size: StripeSize) {
saveStripes({ [side]: size });
}
/** "Show Tool Window Names" (menu or settings) applies to both stripes again. */
export function resetStripeNames() {
const s = useStripes.getState();
if (s.left.names === undefined && s.right.names === undefined) return;
saveStripes({ left: { width: s.left.width }, right: { width: s.right.width } });
}
export function toggleMoreToolWindowsSide() {
saveStripes({ moreSide: useStripes.getState().moreSide === "left" ? "right" : "left" });
}