Elffuss BraidHub

kikocis/continue public

fix: show tool call status icons for other search/replace statuses (#7936)

* feat: focus editor on last cancelation

* fix: show tool call status

* fix: cubic comment
Changesete46c9aad1fc244e6aab0620e5f1db1f99fa70202da67dd10b76ce1c250ffb89e
AuthorDallin Romney <dallinromney@gmail.com> · 2025-09-24 13:23 -07:00
CommitterGitHub <noreply@github.com> · 2025-09-24 13:23 -07:00
Parents36b51df0a775

Browse the files at this changeset

3 files changed

modified gui/src/components/mainInput/Lump/LumpToolbar/LumpToolbar.tsx +13 −2
@@ -12,6 +12,7 @@
1212 import { cancelStream } from "../../../../redux/thunks/cancelStream";
1313 import { logToolUsage } from "../../../../redux/util";
1414 import { isJetBrains } from "../../../../util";
15+import { useMainEditor } from "../../TipTapEditor";
1516 import { BlockSettingsTopToolbar } from "./BlockSettingsTopToolbar";
1617 import { EditOutcomeToolbar } from "./EditOutcomeToolbar";
1718 import { EditToolbar } from "./EditToolbar";
@@ -64,6 +65,7 @@
6465 (state) => state.status === "done",
6566 );
6667 const isApplying = applyStates.some((state) => state.status === "streaming");
68+ const editor = useMainEditor();
6769
6870 // Get ALL running terminal commands
6971 const runningToolCalls = useAppSelector((state) =>
@@ -140,7 +142,10 @@
140142 // Stop running terminal commands
141143 void handleStopAction();
142144 } else if (firstPendingToolCall) {
143- // Cancel pending tool call
145+ // Cancel pending tool call. If last call, focus editor
146+ if (pendingToolCalls.length === 1) {
147+ editor.mainEditor?.commands.focus();
148+ }
144149 void dispatch(
145150 cancelToolCall({
146151 toolCallId: firstPendingToolCall.toolCallId,
@@ -155,7 +160,13 @@
155160 return () => {
156161 document.removeEventListener("keydown", handleToolCallKeyboardShortcuts);
157162 };
158- }, [firstPendingToolCall, hasRunningTerminalCommand, runningTerminalCalls]);
163+ }, [
164+ firstPendingToolCall,
165+ pendingToolCalls,
166+ editor,
167+ hasRunningTerminalCommand,
168+ runningTerminalCalls,
169+ ]);
159170
160171 if (isApplying) {
161172 return <IsApplyingToolbar />;
modified gui/src/components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar.tsx +6 −0
@@ -4,6 +4,7 @@
44 import { cancelToolCallThunk } from "../../../../redux/thunks/cancelToolCall";
55 import { getAltKeyLabel, getMetaKeyLabel, isJetBrains } from "../../../../util";
66 import { Button } from "../../../ui";
7+import { useMainEditor } from "../../TipTapEditor";
78
89 export const generateToolCallButtonTestId = (
910 action: "accept" | "reject",
@@ -16,6 +17,7 @@
1617 const dispatch = useAppDispatch();
1718 const jetbrains = isJetBrains();
1819 const pendingToolCalls = useAppSelector(selectPendingToolCalls);
20+ const editor = useMainEditor();
1921
2022 if (pendingToolCalls.length === 0) {
2123 return null;
@@ -26,6 +28,10 @@
2628 };
2729
2830 const handleReject = (toolCallId: string) => {
31+ // put cursor in editor after last rejection
32+ if (pendingToolCalls.length === 1) {
33+ editor.mainEditor?.commands.focus();
34+ }
2935 void dispatch(cancelToolCallThunk({ toolCallId }));
3036 };
3137
modified gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx +16 −18
@@ -185,24 +185,22 @@
185185 const statusIcon = useMemo(() => {
186186 const status = toolCallState?.status;
187187 if (status) {
188- if (status === "canceled" || status === "errored" || status === "done") {
189- return (
190- <div
191- className={`mr-1 h-4 w-4 flex-shrink-0 ${toolCallState.output ? "cursor-pointer" : ""}`}
192- onClick={(e) => {
193- if (toolCallState.output) {
194- e.stopPropagation();
195- ideMessenger.post("showVirtualFile", {
196- name: "Edit output",
197- content: renderContextItems(toolCallState.output),
198- });
199- }
200- }}
201- >
202- {getStatusIcon(toolCallState.status)}
203- </div>
204- );
205- }
188+ return (
189+ <div
190+ className={`mr-1 h-4 w-4 flex-shrink-0 ${toolCallState.output ? "cursor-pointer" : ""}`}
191+ onClick={(e) => {
192+ if (toolCallState.output) {
193+ e.stopPropagation();
194+ ideMessenger.post("showVirtualFile", {
195+ name: "Edit output",
196+ content: renderContextItems(toolCallState.output),
197+ });
198+ }
199+ }}
200+ >
201+ {getStatusIcon(status)}
202+ </div>
203+ );
206204 }
207205 }, [toolCallState?.status, toolCallState?.output]);
208206