дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
fix(agents): place New Agent Task before Search and shorten its label
A saved main toolbar layout now puts widgets registered since next to their default neighbours instead of at the end of the side, so New Agent Task lands between the Run widget and Search Everywhere rather than after Search. The toolbar button reads "New Task"; its tooltip still names the agent. Refs #4000
Цей коміт міститься в:
1 джерело
5f452a8e36
коміт
d62c978032
6 files changed
+33
-9
No files matched your search
@@ -25,7 +25,7 @@ describe("NewTaskTitleItem", () => {
|
||||
}));
|
||||
render(<NewTaskTitleItem />);
|
||||
|
||||
const main = screen.getByRole("button", { name: "New Agent Task" });
|
||||
const main = screen.getByRole("button", { name: "New Task" });
|
||||
expect(main).toHaveAttribute("data-tooltip", "New Agent Task with Claude Code");
|
||||
fireEvent.click(main);
|
||||
expect(newTask).toHaveBeenCalledOnce();
|
||||
|
||||
@@ -46,7 +46,7 @@ export function NewTaskTitleItem() {
|
||||
>
|
||||
<Icon name={selected ? providerIcon(selected.id) : "toolwindow-agents"} size={iconSize} />
|
||||
<span className={styles.label} data-toolbar-label="">
|
||||
{tx("New Agent Task")}
|
||||
{tx("New Task")}
|
||||
</span>
|
||||
</BarButton>
|
||||
<IconButton
|
||||
|
||||
@@ -2579,6 +2579,7 @@
|
||||
"too old, needs JDK {version}+ · {path}": "too old, needs JDK {version}+ · {path}",
|
||||
"Close Agent Task": "Close Agent Task",
|
||||
"Close and New Agent Task": "Close and New Agent Task",
|
||||
"New Task": "New Task",
|
||||
"New Agent Task with {name}": "New Agent Task with {name}",
|
||||
"Choose Agent": "Choose Agent",
|
||||
"Focus Agent Input": "Focus Agent Input",
|
||||
|
||||
@@ -5274,6 +5274,7 @@
|
||||
"File templates insert this with {code}, indented like the directive; a directive line whose include is empty is dropped. The file template variables apply.": "文件模板通过 {code} 插入此内容,缩进与该指令一致;所含内容为空的指令行将被删除。文件模板变量同样适用。",
|
||||
"Inserted where a file template says {code}.": "插入到文件模板中写有 {code} 的位置。",
|
||||
"Agents": "智能体",
|
||||
"New Task": "新建任务",
|
||||
"New Agent Task": "新建 Agent 任务",
|
||||
"Close Agent Task": "关闭 Agent 任务",
|
||||
"Close and New Agent Task": "关闭并新建 Agent 任务",
|
||||
|
||||
@@ -22,13 +22,22 @@ describe("main toolbar layout", () => {
|
||||
expect(defaultToolbar([]).left).toEqual(["project", VCS_WIDGET]);
|
||||
});
|
||||
|
||||
it("keeps the saved order and appends widgets registered since", () => {
|
||||
it("keeps the saved order and places widgets registered since next to their default neighbours", () => {
|
||||
const saved = { left: ["project"], right: [SEARCH_ENTRY, "run.widget"], hidden: [VCS_WIDGET] };
|
||||
expect(resolveToolbar(saved, items)).toEqual({
|
||||
left: ["project"],
|
||||
center: [],
|
||||
right: [SEARCH_ENTRY, "run.widget", "build.project"],
|
||||
right: [SEARCH_ENTRY, "build.project", "run.widget"],
|
||||
});
|
||||
// A widget added after Run lands before Search Everywhere, not after it.
|
||||
const withAgents = [...items, item("agents.newTask", "right", 20)];
|
||||
const before = { left: ["project", VCS_WIDGET], right: ["build.project", "run.widget", SEARCH_ENTRY], hidden: [] };
|
||||
expect(resolveToolbar(before, withAgents).right).toEqual([
|
||||
"build.project",
|
||||
"run.widget",
|
||||
"agents.newTask",
|
||||
SEARCH_ENTRY,
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps widgets moved to the Center group there, and hides them from it", () => {
|
||||
@@ -38,7 +47,7 @@ describe("main toolbar layout", () => {
|
||||
expect(resolveToolbar({ left: ["project"], right: [] }, items).center).toEqual([]);
|
||||
expect(shown.center).toEqual(["project", VCS_WIDGET]);
|
||||
expect(shown.left).toEqual([]);
|
||||
expect(shown.right).toEqual([SEARCH_ENTRY, "build.project", "run.widget"]);
|
||||
expect(shown.right).toEqual(["build.project", "run.widget", SEARCH_ENTRY]);
|
||||
const hidden = toggleWidget(editableToolbar(saved, items), "project", "left");
|
||||
expect(hidden.center).toEqual([VCS_WIDGET]);
|
||||
expect(hidden.hidden).toEqual(["project"]);
|
||||
|
||||
@@ -56,7 +56,7 @@ export function defaultToolbar(items: Iterable<TitleItemContribution>): ToolbarL
|
||||
|
||||
/**
|
||||
* The entries to show per side: the saved order, plus widgets registered since
|
||||
* (not listed, not removed) at their default side's end.
|
||||
* (not listed, not removed) next to their default neighbours.
|
||||
*/
|
||||
export function resolveToolbar(
|
||||
saved: MainToolbarSettings | null | undefined,
|
||||
@@ -71,12 +71,25 @@ export function resolveToolbar(
|
||||
const center = [...(saved.center ?? [])];
|
||||
const right = [...(saved.right ?? [])];
|
||||
const known = new Set([...left, ...center, ...right, ...(saved.hidden ?? [])]);
|
||||
const d = defaultWidgets(list);
|
||||
for (const id of d.left) if (!known.has(id)) left.push(id);
|
||||
for (const id of d.right) if (!known.has(id)) right.push(id);
|
||||
const d = defaultToolbar(list);
|
||||
for (const id of d.left) if (!known.has(id)) insertAtDefault(left, id, d.left);
|
||||
for (const id of d.right) if (!known.has(id) && !isActionEntry(id)) insertAtDefault(right, id, d.right);
|
||||
return { left, center, right };
|
||||
}
|
||||
|
||||
/** Puts a new widget after its default predecessor on the side, else before its default successor, else at the end. */
|
||||
function insertAtDefault(side: string[], id: string, defaults: readonly string[]) {
|
||||
const at = defaults.indexOf(id);
|
||||
const before = defaults
|
||||
.slice(0, at)
|
||||
.reverse()
|
||||
.find((e) => side.includes(e));
|
||||
if (before !== undefined) return side.splice(side.indexOf(before) + 1, 0, id);
|
||||
const after = defaults.slice(at + 1).find((e) => side.includes(e));
|
||||
if (after !== undefined) return side.splice(side.indexOf(after), 0, id);
|
||||
side.push(id);
|
||||
}
|
||||
|
||||
/** The full editable layout (Customize Main Toolbar dialog). */
|
||||
export function editableToolbar(
|
||||
saved: MainToolbarSettings | null | undefined,
|
||||
|
||||
Reference in new issue
Заблокувати користувача