feat(debugger): completion in Evaluate, the Variables evaluate field and the Debug console (#1102)

While suspended, the debugger's expression fields complete from the debug adapter (DAP completions) in the selected frame: Evaluate, the Variables evaluate field and the Debug console share one hook. The list opens while typing an identifier or after '.', or on Ctrl+Space; Up/Down, Enter/Tab, Escape. The Evaluate dialog is resizable and its result tree grows with it. Backend: ide-dap completions (skipped without supportsCompletionsRequest), debug_completions on the host and the desktop app.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-04 04:47:12 +08:00
1 джерело e575bf8c24
коміт fe0ee338f4
13 files changed
+481 -6

No files matched your search

+11 -1
Переглянути файл
@@ -37,6 +37,7 @@ import {
} from "../state";
import { DebugConsole } from "./DebugConsole";
import { VariablesView, type VarRoot } from "./VariablesView";
import { useExpressionCompletion } from "./ExpressionCompletion";
import { sortVariables } from "../values";
import { workflowSettings } from "@/platform/workflowSettings";
import styles from "./DebugToolWindow.module.css";
@@ -378,6 +379,8 @@ function VariablesPane({ session }: { session: DebugSession }) {
const watches = useDebug((s) => s.watches);
const stopSeq = useDebug((s) => s.stopSeq);
const [expression, setExpression] = useState("");
const evalField = useRef<HTMLInputElement>(null);
const completion = useExpressionCompletion(evalField, expression, setExpression, session);
const [lastEval, setLastEval] = useState<EvalRow | null>(null);
const [scopeData, setScopeData] = useState<{ frame: number | null; scopes: Scope[]; locals: Variable[] }>({
frame: null,
@@ -502,10 +505,16 @@ function VariablesPane({ session }: { session: DebugSession }) {
<div className={styles.variables}>
<div className={styles.evalField}>
<input
ref={evalField}
className={styles.evalInput}
value={expression}
onChange={(e) => setExpression(e.target.value)}
onChange={(e) => {
setExpression(e.target.value);
completion.onInput();
}}
onBlur={completion.close}
onKeyDown={(e) => {
if (completion.onKeyDown(e)) return;
if (e.key === "Enter" && (e.metaKey || e.ctrlKey) && e.shiftKey) {
e.preventDefault();
addWatch(expression);
@@ -521,6 +530,7 @@ function VariablesPane({ session }: { session: DebugSession }) {
autoComplete="off"
disabled={frame == null}
/>
{completion.popup}
<IconButton
icon="plus"
title="Add to Watches"