From 764cc9c519b95095e6828b5de8d2cb3a5d2e70d0 Mon Sep 17 00:00:00 2001
From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>
Date: Fri, 6 Nov 2026 01:03:42 +0800
Subject: [PATCH] feat(debugger): console actions in a toolbar on the left of
the debug Console
Scroll to End, Soft-Wrap and Clear sat at the far right of the evaluate row,
easy to miss or cut off in a narrow window. The Console tab now has the same
vertical toolbar as the Run window: Find, Scroll to End, Soft-Wrap and Clear.
---
src/features/debugger/ui/DebugConsole.tsx | 191 +++++++++---------
.../debugger/ui/DebugToolWindow.module.css | 17 ++
src/platform/locales/text/zh.json | 1 +
3 files changed, 118 insertions(+), 91 deletions(-)
diff --git a/src/features/debugger/ui/DebugConsole.tsx b/src/features/debugger/ui/DebugConsole.tsx
index 9cbc0cb0..f791a053 100644
--- a/src/features/debugger/ui/DebugConsole.tsx
+++ b/src/features/debugger/ui/DebugConsole.tsx
@@ -365,111 +365,120 @@ export function DebugConsole({ session, interactive = true }: { session: DebugSe
};
return (
-
- {findOpen && (
-
goToMatch(1)}
- onPrevious={() => goToMatch(-1)}
- onClose={closeFind}
- />
- )}
+
{
- if (programmatic.current) return;
- const el = e.currentTarget;
- const atEnd = el.scrollHeight - el.scrollTop - el.clientHeight < 24;
- if (atEnd !== stick.current) setFollow(atEnd);
- }}
- onContextMenu={onContextMenu}
- role="log"
- onKeyDown={onOutputKeyDown}
- aria-label={tx("Debug console")}
- tabIndex={0}
+ className={styles.consoleToolbar}
+ role="toolbar"
+ aria-orientation="vertical"
+ aria-label={tx("Console actions")}
>
- {!lines?.length && session.launch?.request === "attach" && (
-
The attached process may not provide standard output to the debugger.
- )}
-
- {virtualizer.getVirtualItems().map((item) => {
- const l = lines?.[item.index];
- if (!l) return null;
- return (
-
- {findSegments(l.spans, marksByLine.get(item.index) ?? [], current).map(segmentNode)}
-
- );
- })}
-
-
-
- {interactive && (
- <>
-
- ›
-
- setConsoleHistoryBrowser(browseHistory)}
- onBlur={() => {
- setConsoleHistoryBrowser(null);
- completion.close();
- }}
- value={input}
- onChange={(e) => {
- setInput(e.target.value);
- completion.onInput();
- }}
- onKeyDown={onKeyDown}
- placeholder={isLive(session) ? "Evaluate in the debug console" : "Session finished"}
- disabled={!isLive(session)}
- aria-label={tx("Debug console input")}
- spellCheck={false}
- autoComplete="off"
- />
- {completion.popup}
- >
- )}
+ (findOpen ? closeFind() : openFind())}
+ />
setFollow((v) => !v)}
/>
setWrapOverride(!softWrap)}
/>
- clearConsole(session.id)}
- />
+ clearConsole(session.id)} />
+
+
+ {findOpen && (
+
goToMatch(1)}
+ onPrevious={() => goToMatch(-1)}
+ onClose={closeFind}
+ />
+ )}
+ {
+ if (programmatic.current) return;
+ const el = e.currentTarget;
+ const atEnd = el.scrollHeight - el.scrollTop - el.clientHeight < 24;
+ if (atEnd !== stick.current) setFollow(atEnd);
+ }}
+ onContextMenu={onContextMenu}
+ role="log"
+ onKeyDown={onOutputKeyDown}
+ aria-label={tx("Debug console")}
+ tabIndex={0}
+ >
+ {!lines?.length && session.launch?.request === "attach" && (
+
The attached process may not provide standard output to the debugger.
+ )}
+
+ {virtualizer.getVirtualItems().map((item) => {
+ const l = lines?.[item.index];
+ if (!l) return null;
+ return (
+
+ {findSegments(l.spans, marksByLine.get(item.index) ?? [], current).map(segmentNode)}
+
+ );
+ })}
+
+
+
+ {interactive && (
+ <>
+
+ ›
+
+ setConsoleHistoryBrowser(browseHistory)}
+ onBlur={() => {
+ setConsoleHistoryBrowser(null);
+ completion.close();
+ }}
+ value={input}
+ onChange={(e) => {
+ setInput(e.target.value);
+ completion.onInput();
+ }}
+ onKeyDown={onKeyDown}
+ placeholder={isLive(session) ? "Evaluate in the debug console" : "Session finished"}
+ disabled={!isLive(session)}
+ aria-label={tx("Debug console input")}
+ spellCheck={false}
+ autoComplete="off"
+ />
+ {completion.popup}
+ >
+ )}
+
);
diff --git a/src/features/debugger/ui/DebugToolWindow.module.css b/src/features/debugger/ui/DebugToolWindow.module.css
index f428fc6e..f13d3bbc 100644
--- a/src/features/debugger/ui/DebugToolWindow.module.css
+++ b/src/features/debugger/ui/DebugToolWindow.module.css
@@ -218,6 +218,23 @@
}
/* console */
+/* The Console tab: actions in a vertical strip on the left, as in the Run window. */
+.consoleArea {
+ flex: 1;
+ min-width: 0;
+ min-height: 0;
+ display: flex;
+}
+.consoleToolbar {
+ flex: none;
+ width: 32px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 2px;
+ padding: 4px 0;
+ border-right: 1px solid var(--border);
+}
.console {
flex: 1;
min-width: 0;
diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json
index bb312d53..4bb0f324 100644
--- a/src/platform/locales/text/zh.json
+++ b/src/platform/locales/text/zh.json
@@ -1935,6 +1935,7 @@
"Run a configuration with coverage to see which lines its tests execute.": "使用覆盖率运行配置,即可查看其测试执行了哪些行。",
"Run a request from an .http file with the gutter ▶ or ⌘↩.": "使用装订区域中的 ▶ 或 ⌘↩ 运行 .http 文件中的请求。",
"Run actions": "运行操作",
+ "Console actions": "控制台操作",
"Run and Debug": "运行和调试",
"Run code cleanup": "运行代码清理",
"Run configurations": "运行配置",