дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +02:00
Quick Evaluate built the expression from the identifier and its member chain only, so on o.getX() it sent o.getX, which Java adapters resolve as a field, and it evaluated with the hover context, in which adapters refuse to call methods. Quick Evaluate and the Evaluate dialog seed now take the call of the clicked identifier and member chains through calls and indexing, and Quick Evaluate uses the watch context. Plain hovers and value-on-selection stay side-effect free.
1187 рядки
42 KiB
TypeScript
1187 рядки
42 KiB
TypeScript
/** Debugger actions (ids match `keymaps/intellij-macos.ts`). */
|
||
import { executeAction, getAction, registerActions, type Action } from "@/platform/actions";
|
||
import {
|
||
call,
|
||
commands,
|
||
isCancelled,
|
||
isTauri,
|
||
nextRequestId,
|
||
type AttachableProcess,
|
||
type DebugSessionId,
|
||
type LaunchConfig,
|
||
type RunConfig,
|
||
type RunId,
|
||
} from "@/platform/ipc";
|
||
import { downloadJdkActions } from "@/platform/jdk";
|
||
import { useProject } from "@/platform/project";
|
||
import { isRemoteWindow } from "@/platform/remote";
|
||
import { openExternalUrl } from "@/platform/openUrl";
|
||
import { activeEditor } from "@/editor/api";
|
||
import type { EditorView } from "@codemirror/view";
|
||
import { maybeEditorService, notifications, showStatusInfo, toolWindowService } from "@/workbench/contributions";
|
||
import { classFileBreakpointReason } from "@/platform/classFiles";
|
||
import { lineHasCode } from "./breakpoints/codeLines";
|
||
import { canPlaceBreakpoint } from "./breakpoints/languages";
|
||
import {
|
||
removeAllBreakpoints,
|
||
setMuted,
|
||
toggleBreakpoint,
|
||
toggleTemporaryBreakpoint,
|
||
useBreakpoints,
|
||
} from "./breakpoints/store";
|
||
import { removeAllSpecial, specialAt, toggleFieldAt, toggleMethodAt } from "./breakpoints/special";
|
||
import { fieldAt, methodAt } from "./breakpoints/symbols";
|
||
import { toggleBreakpointSmart } from "./breakpoints/toggle";
|
||
import {
|
||
isJavaAttachTarget,
|
||
isJavaDebuggable,
|
||
javaAttachConfig,
|
||
javaLaunchConfig,
|
||
jvmAttachDebuggerReady,
|
||
} from "./java";
|
||
import { cancelHotSwapBuild, reloadChangedClasses } from "./hotswap";
|
||
import { refreshMemory, useMemory } from "./memory/memoryState";
|
||
import { closeInstances, instancesOutdated, showInstances, showReferrers, useInstances } from "./memory/instancesState";
|
||
import { jumpToClass } from "./memory/jumpToClass";
|
||
import { captureHeap } from "./heap/heapState";
|
||
import { stopRecording, traceStreamChain } from "./streams/streamState";
|
||
import { isTracing, useStreamTrace } from "./streams/streamStore";
|
||
import { startPageProfile, stopPageProfile } from "./js/profile";
|
||
import { activeCapturedSnapshot, openHeapDump, saveHeapDump } from "./heap/heapDumpFiles";
|
||
import { browserLaunch, browserLaunchConfig, browserUrl, installedDebugBrowser, isBrowserConfig } from "./browser";
|
||
import { warnPinnedFlutterDevice } from "@/workbench/flutterDevices";
|
||
import { DEVTOOLS_WINDOWS, devToolsUrl, refreshDevTools } from "./flutter/devTools";
|
||
import { debugUnsupportedReason, launchConfigFor, withEnvFiles } from "./launch";
|
||
import { attachConfig } from "./attach";
|
||
import {
|
||
isPythonAttachTarget,
|
||
isRemoteConfig,
|
||
pythonAttachConfig,
|
||
REMOTE_JVM,
|
||
remoteAttachConfig,
|
||
remoteJvmTarget,
|
||
} from "./remote";
|
||
import {
|
||
activeSession,
|
||
resumeExecution,
|
||
evaluate,
|
||
isLive,
|
||
justDetached,
|
||
pausedThread,
|
||
rerunSession,
|
||
revealFrame,
|
||
rootOf,
|
||
selectedFrame,
|
||
sessionSupports,
|
||
showExecutionPoint,
|
||
startBrowserSession,
|
||
startSession,
|
||
startPreparedSession,
|
||
stopSession,
|
||
stopAssociatedProcess,
|
||
stopTarget,
|
||
useDebug,
|
||
type DebugSession,
|
||
} from "./state";
|
||
import { focusedDebugView } from "./ui/focusedView";
|
||
import { browseFocusedConsoleHistory } from "./ui/expressionHistory";
|
||
import { expressionAt, showQuickValue } from "./editor/valueTooltip";
|
||
import { mouseEvaluateTarget } from "./editor/quickEvaluate";
|
||
import { showHint } from "@/editor/lsp/hint";
|
||
import { pausedLineTargets, startInlineSmartStep } from "./editor/smartStep";
|
||
import {
|
||
openBreakpointsDialog,
|
||
openConfigChooser,
|
||
openEvaluateDialog,
|
||
openSmartStepChooser,
|
||
useOverlays,
|
||
} from "./ui/popoverStore";
|
||
import { tx } from "@/platform/i18n";
|
||
import { openAttachPopup } from "./attachPopup";
|
||
|
||
function isRunConfig(arg: unknown): arg is RunConfig {
|
||
return !!arg && typeof arg === "object" && "command" in arg && "args" in arg && "debugAdapter" in arg;
|
||
}
|
||
|
||
/** `debug.attach`'s argument for a process listed by Attach to Process (a plugin run's child). */
|
||
function isAttachableTarget(
|
||
arg: unknown,
|
||
): arg is { attachable: AttachableProcess; process?: RunId | null; runConfig?: RunConfig; show?: boolean } {
|
||
const a = (arg && typeof arg === "object" ? arg : {}) as { attachable?: Partial<AttachableProcess> };
|
||
return typeof a.attachable?.pid === "number" && typeof a.attachable.kind === "string";
|
||
}
|
||
|
||
function errorText(e: unknown) {
|
||
return e instanceof Error ? e.message : String(e);
|
||
}
|
||
|
||
async function report(title: string, p: Promise<unknown>) {
|
||
try {
|
||
await p;
|
||
} catch (e) {
|
||
// A Java launch without a JDK new enough (for jdtls or the project) offers to download one.
|
||
const actions = downloadJdkActions(errorText(e));
|
||
notifications().notify({ group: "run", level: "error", title, body: errorText(e), key: "debug.action", actions });
|
||
}
|
||
}
|
||
|
||
/** The paused session and the thread to act on. */
|
||
function pausedTarget(): { s: DebugSession; thread: number } | null {
|
||
const s = activeSession();
|
||
if (!s || s.status !== "paused") return null;
|
||
const thread = pausedThread(s);
|
||
return thread == null ? null : { s, thread };
|
||
}
|
||
|
||
/** The trace tab passes its own session; from elsewhere, the active session's trace. */
|
||
function traceTarget(arg: unknown): DebugSessionId | undefined {
|
||
return typeof arg === "number" ? arg : activeSession()?.id;
|
||
}
|
||
|
||
function breakpointPathAllowed(path: string): boolean {
|
||
const reason = classFileBreakpointReason(path);
|
||
if (!reason) return true;
|
||
showStatusInfo(tx(reason));
|
||
return false;
|
||
}
|
||
|
||
/** Run to Cursor at `line` (0-based) of `path` in the paused session. */
|
||
export function runToLine(path: string, line: number) {
|
||
const t = pausedTarget();
|
||
if (t && breakpointPathAllowed(path))
|
||
void report(
|
||
tx("Run to Cursor failed"),
|
||
resumeExecution(t.s.id, () => call(commands.debugRunTo(t.s.id, t.thread, path, line, false))),
|
||
);
|
||
}
|
||
|
||
function notSupported(what: string, s: DebugSession) {
|
||
notifications().notify({
|
||
group: "run",
|
||
level: "info",
|
||
key: "debug.unsupported",
|
||
title: `${what} is not supported by ${s.adapter || "this debugger"}`,
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Smart Step Into: the calls on the current line, picked in the editor (the
|
||
* dialog when they cannot be placed); one call (or none) steps straight in, like IDEA.
|
||
*/
|
||
async function smartStepInto() {
|
||
const t = pausedTarget();
|
||
if (!t) return;
|
||
const frame = selectedFrame(t.s);
|
||
if (!frame || !sessionSupports("stepInTargets", t.s)) {
|
||
await resumeExecution(t.s.id, () => call(commands.debugStep(t.s.id, t.thread, "into")));
|
||
return;
|
||
}
|
||
const targets = pausedLineTargets(await call(commands.debugStepInTargets(t.s.id, frame.id)));
|
||
if (targets.length <= 1) {
|
||
await resumeExecution(t.s.id, () =>
|
||
call(
|
||
targets[0]
|
||
? commands.debugStepInTarget(t.s.id, t.thread, targets[0].id)
|
||
: commands.debugStep(t.s.id, t.thread, "into"),
|
||
),
|
||
);
|
||
return;
|
||
}
|
||
if (!startInlineSmartStep(t.s.id, t.thread, targets)) openSmartStepChooser(t.s.id, t.thread, targets);
|
||
}
|
||
|
||
function cursor(): { path: string; line: number; selection: string } | null {
|
||
const ed = activeEditor();
|
||
if (!ed) return null;
|
||
const { state } = ed.view;
|
||
const main = state.selection.main;
|
||
return {
|
||
path: ed.ctx.path,
|
||
line: state.doc.lineAt(main.head).number - 1,
|
||
selection: state.sliceDoc(main.from, main.to),
|
||
};
|
||
}
|
||
|
||
/** Evaluate's initial text, as in IDEA: the selection, else the expression at the caret. */
|
||
function evaluateSeed(view: EditorView | undefined = activeEditor()?.view, pos?: number): string {
|
||
if (!view) return "";
|
||
const { state } = view;
|
||
const sel = state.selection.main;
|
||
if (!sel.empty && (pos == null || (sel.from <= pos && pos <= sel.to))) return state.sliceDoc(sel.from, sel.to);
|
||
return expressionAt(view, pos ?? sel.head, { calls: true })?.text ?? "";
|
||
}
|
||
|
||
async function quickEvaluate(arg?: unknown) {
|
||
const target = mouseEvaluateTarget(arg);
|
||
const view = target?.view ?? activeEditor()?.view;
|
||
if (!view) return;
|
||
const { doc, selection } = view.state;
|
||
const pos = target?.pos ?? selection.main.from;
|
||
const expression = evaluateSeed(view, target?.pos).trim();
|
||
if (!expression) return showHint(view, "Nothing to evaluate at the caret");
|
||
const session = activeSession();
|
||
const stop = useDebug.getState().stopSeq;
|
||
const stillCurrent = () => {
|
||
const current = activeSession();
|
||
return (
|
||
view.dom.isConnected &&
|
||
view.state.doc === doc &&
|
||
view.state.selection.eq(selection) &&
|
||
current?.status === "paused" &&
|
||
current.id === session?.id &&
|
||
current.selectedFrame === session?.selectedFrame &&
|
||
useDebug.getState().stopSeq === stop
|
||
);
|
||
};
|
||
try {
|
||
// Unlike a plain hover, an explicit Quick Evaluate may call methods (adapters refuse that for "hover").
|
||
const value = await evaluate(expression, "watch", session);
|
||
if (session && stillCurrent()) showQuickValue(view, pos, expression, value, session.id);
|
||
} catch (e) {
|
||
if (stillCurrent()) showHint(view, e instanceof Error ? e.message : String(e), { pos, tone: "error" });
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Remote JVM Debug in listen mode: the IDE listens and the remote JVM connects; java-debug
|
||
* then attaches through a loopback relay. Null when cancelled.
|
||
*/
|
||
async function listenForJvm(name: string, host: string, port: number): Promise<number | null> {
|
||
const request = nextRequestId();
|
||
const key = `debug.listen.${request}`;
|
||
notifications().notify({
|
||
group: "run",
|
||
level: "info",
|
||
key,
|
||
sticky: true,
|
||
title: `'${name}': listening for the remote JVM on port ${port}`,
|
||
body: tx`Start the remote JVM with -agentlib:jdwp=transport=dt_socket,server=n,address=${host}:${port},suspend=y`,
|
||
actions: [{ label: "Cancel", run: () => void commands.cancelRequest(request) }],
|
||
});
|
||
try {
|
||
return await call(commands.debugListenForJvm(request, host, port));
|
||
} catch (e) {
|
||
if (isCancelled(e)) return null;
|
||
throw e;
|
||
} finally {
|
||
notifications().expire?.(key);
|
||
}
|
||
}
|
||
|
||
/** Remote JVM Debug, Go Remote, Python / Node.js remote: attach over host:port. */
|
||
async function startRemote(config: RunConfig, root: string, show?: boolean) {
|
||
if (config.kind === REMOTE_JVM) {
|
||
const t = remoteJvmTarget(config);
|
||
let hostName = t.host;
|
||
let port = t.port;
|
||
if (t.mode === "listen") {
|
||
const relay = await listenForJvm(config.name, t.host, t.port);
|
||
if (relay == null) return;
|
||
[hostName, port] = ["127.0.0.1", relay];
|
||
}
|
||
const launch = await javaAttachConfig({ name: config.name, module: t.module, hostName, port }, root);
|
||
// A listen relay accepts one debugger: rerunning listens again through the configuration.
|
||
await startSession(launch, { runConfig: config, rerunnable: t.mode === "attach", show });
|
||
return;
|
||
}
|
||
const launch = remoteAttachConfig(config, root);
|
||
if (launch) await startSession(launch, { runConfig: config, show });
|
||
}
|
||
|
||
/** The browser opens on this desktop, which a remote project's debugger can't reach. */
|
||
function browserUnavailable(name: string): boolean {
|
||
if (!isRemoteWindow()) return false;
|
||
notifications().notify({
|
||
group: "run",
|
||
level: "warning",
|
||
title: `“${name}” can't be debugged`,
|
||
body: "JavaScript Debug isn't available in a remote project yet.",
|
||
});
|
||
return true;
|
||
}
|
||
|
||
/** The browser opens on this desktop, which can't reach a server on a remote project's machine. */
|
||
async function openDevTools(vmServiceUri: string) {
|
||
if (isRemoteWindow()) {
|
||
notifications().notify({
|
||
group: "run",
|
||
level: "warning",
|
||
title: "Flutter DevTools isn't available in a remote project yet",
|
||
});
|
||
return;
|
||
}
|
||
const server = await call(commands.flutterDevtoolsUrl());
|
||
await openExternalUrl(devToolsUrl(server, { page: "inspector" }, { uri: vmServiceUri }));
|
||
}
|
||
|
||
async function startBrowser(config: RunConfig, root: string, show?: boolean) {
|
||
if (browserUnavailable(config.name)) return;
|
||
const launch = browserLaunchConfig(config, root);
|
||
if (launch) await startBrowserSession(launch, { runConfig: config, show });
|
||
}
|
||
|
||
/** Debugs the page at a URL without a configuration (a link in a console). */
|
||
async function debugInBrowser(arg: unknown) {
|
||
const root = useProject.getState().project?.root;
|
||
const url = typeof arg === "string" ? browserUrl(arg) : null;
|
||
if (!root || !url) return;
|
||
const name = new URL(url).host || url;
|
||
if (browserUnavailable(name)) return;
|
||
await startBrowserSession(browserLaunch(name, url, await installedDebugBrowser(), root));
|
||
}
|
||
|
||
/** Preparation belongs to a session from the moment the action begins. */
|
||
async function startJavaConfig(config: RunConfig, root: string, origin: RunConfig, show?: boolean) {
|
||
await startPreparedSession(
|
||
origin,
|
||
async (signal, report) => {
|
||
const request = nextRequestId();
|
||
const cancel = () => {
|
||
void commands.cancelRequest(request).catch(() => undefined);
|
||
};
|
||
signal.addEventListener("abort", cancel, { once: true });
|
||
try {
|
||
return await javaLaunchConfig(config, root, {
|
||
request,
|
||
signal,
|
||
report,
|
||
saveAll: async () => {
|
||
await maybeEditorService()?.saveAll();
|
||
},
|
||
});
|
||
} finally {
|
||
signal.removeEventListener("abort", cancel);
|
||
}
|
||
},
|
||
{ show },
|
||
);
|
||
}
|
||
|
||
async function startConfig(arg: unknown) {
|
||
const root = useProject.getState().project?.root;
|
||
if (!root) return;
|
||
const origin = arg && typeof arg === "object" && "origin" in arg && isRunConfig(arg.origin) ? arg.origin : null;
|
||
const show = arg && typeof arg === "object" && "show" in arg ? (arg as { show?: boolean }).show : undefined;
|
||
const input = arg && typeof arg === "object" && "config" in arg ? arg.config : arg;
|
||
let config: RunConfig | null = isRunConfig(input) ? input : null;
|
||
if (!config) {
|
||
if (!isTauri()) {
|
||
notifications().notify({ group: "run", level: "warning", title: "Debugging needs the desktop app" });
|
||
return;
|
||
}
|
||
const configs = (await call(commands.runConfigs())).filter((c) => c.debugAdapter);
|
||
if (!configs.length) {
|
||
notifications().notify({
|
||
group: "run",
|
||
level: "info",
|
||
title: "Nothing to debug",
|
||
body: "No run configuration in this project has a debug adapter.",
|
||
});
|
||
return;
|
||
}
|
||
if (configs.length > 1) {
|
||
openConfigChooser(configs);
|
||
return;
|
||
}
|
||
config = configs[0]!;
|
||
// Through Run's debug flow: Maven / Gradle / scripts start the JVM with a JDWP agent there.
|
||
if (getAction("run.debugConfig")) {
|
||
await executeAction("run.debugConfig", show === false ? { config, show: false } : config);
|
||
return;
|
||
}
|
||
}
|
||
if (isRemoteConfig(config)) {
|
||
await startRemote(config, root, show);
|
||
return;
|
||
}
|
||
if (isBrowserConfig(config)) {
|
||
await startBrowser(config, root, show);
|
||
return;
|
||
}
|
||
if (isJavaDebuggable(config)) {
|
||
await startJavaConfig(config, root, origin ?? config, show);
|
||
return;
|
||
}
|
||
if (config.kind === "plugin") config = await call(commands.pluginPrepareDebugRun(config));
|
||
const dotnet = config.kind === "dotnet" && config.debugAdapter === "netcoredbg";
|
||
const prepared = dotnet ? await call(commands.runDotnetResolve(config, true)) : config;
|
||
// php-debug starts the PHP chosen in Settings unless the command names one.
|
||
const php =
|
||
config.debugAdapter === "php-debug" && isTauri() ? await call(commands.sdkPhpEffective()).catch(() => null) : null;
|
||
const launch = launchConfigFor(await withEnvFiles(prepared, root), root, php);
|
||
if (!launch) {
|
||
notifications().notify({
|
||
group: "run",
|
||
level: "warning",
|
||
title: `“${config.name}” can't be debugged`,
|
||
body: debugUnsupportedReason(config) ?? "It has no debug adapter.",
|
||
});
|
||
return;
|
||
}
|
||
if (config.debugAdapter === "dart") warnPinnedFlutterDevice(config);
|
||
const xdebugCheck = config.debugAdapter === "php-debug" && isTauri() ? warnWithoutXdebug(launch) : null;
|
||
await maybeEditorService()
|
||
?.saveAll()
|
||
.catch(() => undefined);
|
||
await startSession(launch, { runConfig: origin ?? config, show });
|
||
await xdebugCheck;
|
||
}
|
||
|
||
/**
|
||
* A PHP without the Xdebug extension ignores the `-dxdebug.*` options php-debug starts it with: the
|
||
* script runs past every breakpoint. Warns, without holding the session back (a command may load
|
||
* Xdebug itself with `-dzend_extension=`).
|
||
*/
|
||
async function warnWithoutXdebug(launch: LaunchConfig) {
|
||
const runtime = (JSON.parse(launch.extraJson ?? "{}") as { runtimeExecutable?: string }).runtimeExecutable;
|
||
// Without one, php-debug runs the `php` on the search path.
|
||
const php = runtime ?? (await call(commands.sdkLocateTools(["php"], null)).catch(() => null))?.tools[0]?.path;
|
||
// In the session's folder: a version manager's `php` shim picks the PHP from it.
|
||
const probe = php ? await call(commands.sdkPhpXdebug(php, launch.cwd)).catch(() => null) : null;
|
||
if (!probe || probe.xdebug) return;
|
||
notifications().notify({
|
||
group: "run",
|
||
level: "warning",
|
||
key: "debug.phpXdebug",
|
||
title: `Xdebug is not loaded in PHP ${probe.phpVersion}`,
|
||
body: tx`${probe.php} runs without Xdebug, so breakpoints are skipped. Install Xdebug 3 for this PHP or choose another PHP interpreter.`,
|
||
actions: [{ label: "Open PHP Settings", run: () => void executeAction("file.settings", "languages.php") }],
|
||
});
|
||
}
|
||
|
||
export function registerDebugActions(): () => void {
|
||
// A stream trace runs the program from the paused thread, so nothing may move it until the trace ends.
|
||
const paused = "debugSessionPaused && !debugStreamTracing";
|
||
const step = (id: string, title: string, kind: "over" | "into" | "out", icon: string): Action => ({
|
||
id,
|
||
title,
|
||
category: "Debug",
|
||
icon,
|
||
when: paused,
|
||
run: () => {
|
||
const t = pausedTarget();
|
||
if (t)
|
||
void report(
|
||
title,
|
||
resumeExecution(t.s.id, () => call(commands.debugStep(t.s.id, t.thread, kind))),
|
||
);
|
||
},
|
||
});
|
||
|
||
return registerActions([
|
||
{
|
||
id: "debug.pluginStart",
|
||
title: "Debug Plugin Configuration",
|
||
category: "Debug",
|
||
hidden: true,
|
||
when: "projectOpen",
|
||
run: async ({ arg }) => {
|
||
const a = arg as { config: RunConfig; onExit: (code: number | null, stopped: boolean) => void };
|
||
const config = await call(commands.pluginPrepareDebugRun(a.config));
|
||
const root = useProject.getState().project?.root;
|
||
if (!root) throw new Error("No project");
|
||
const launch = launchConfigFor(await withEnvFiles(config, root), root);
|
||
if (!launch) throw new Error("This configuration has no debugger");
|
||
let id: number | null = null;
|
||
let stopped = false;
|
||
const observe = () => {
|
||
if (id === null) return;
|
||
const session = useDebug.getState().sessions[id];
|
||
if (session?.status === "stopping") stopped = true;
|
||
if (!session || session.status === "terminated") {
|
||
off();
|
||
a.onExit(session?.exitCode ?? null, stopped);
|
||
}
|
||
};
|
||
const off = useDebug.subscribe(observe);
|
||
try {
|
||
await maybeEditorService()?.saveAll();
|
||
id = await startSession(launch, { runConfig: config });
|
||
if (id === null) {
|
||
off();
|
||
throw new Error("Debug session did not start");
|
||
}
|
||
observe();
|
||
} catch (error) {
|
||
off();
|
||
throw error;
|
||
}
|
||
},
|
||
},
|
||
{
|
||
id: "debug.startConfig",
|
||
title: "Debug…",
|
||
category: "Debug",
|
||
icon: "debug",
|
||
description: "Start debugging a run configuration",
|
||
run: ({ arg }) => report(tx("Cannot start debugging"), startConfig(arg)),
|
||
},
|
||
{
|
||
id: "debug.attach",
|
||
title: "Attach Debugger",
|
||
category: "Debug",
|
||
hidden: true,
|
||
// Also debugpy to a Python program in a run target's container
|
||
// (arg: { name, adapter: "debugpy", hostName, port, remoteRoot, process }).
|
||
// Also a process from Attach to Process (arg: { attachable, process, runConfig }).
|
||
description:
|
||
"Attach the Java debugger to a JVM listening for JDWP (arg: { name, module, hostName, port, process })",
|
||
run: ({ arg }) =>
|
||
report(
|
||
tx("Cannot attach the debugger"),
|
||
(async () => {
|
||
const root = useProject.getState().project?.root;
|
||
if (!root) return;
|
||
let launch: LaunchConfig;
|
||
if (isAttachableTarget(arg)) launch = await attachConfig(arg.attachable, root);
|
||
else if (isPythonAttachTarget(arg)) launch = pythonAttachConfig(arg, root);
|
||
else if (isJavaAttachTarget(arg)) launch = await javaAttachConfig(arg, root);
|
||
else return;
|
||
const process = (arg.process ?? null) as RunId | null;
|
||
// Another JVM of the same run (a Gradle test worker, the one just detached) keeps it.
|
||
const shared =
|
||
process != null &&
|
||
(justDetached(process) ||
|
||
Object.values(useDebug.getState().sessions).some((s) => s.process === process && isLive(s)));
|
||
const session = await startSession(launch, {
|
||
process,
|
||
runConfig: arg.runConfig,
|
||
rerunnable: false,
|
||
show: (arg as { show?: boolean }).show,
|
||
});
|
||
// The process was started for this debugger and waits for it (`suspend=y`): without
|
||
// the attach it would never go on, and Stop on the finished session can't reach it.
|
||
if (session == null && process != null && !shared) await stopAssociatedProcess(process);
|
||
})(),
|
||
),
|
||
},
|
||
{
|
||
id: "debug.jvmAttachReady",
|
||
title: "Check the JVM Debugger",
|
||
category: "Debug",
|
||
hidden: true,
|
||
description:
|
||
"Whether the debugger for a build tool's JVMs is installed, offering the install when not (arg: { module, retry, done(ready) })",
|
||
run: ({ arg }) => {
|
||
const a = arg as { module: string; retry: () => void; done: (ready: boolean) => void };
|
||
const root = useProject.getState().project?.root;
|
||
if (!root) return a.done(true);
|
||
void jvmAttachDebuggerReady(a.module, root, a.retry).then(a.done, () => a.done(true));
|
||
},
|
||
},
|
||
{
|
||
id: "debug.stop",
|
||
title: "Stop",
|
||
category: "Debug",
|
||
icon: "stop",
|
||
when: "debugCanStop",
|
||
run: () => {
|
||
const s = stopTarget();
|
||
if (s) void stopSession(s.id);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.reloadChangedClasses",
|
||
title: "Reload Changed Classes",
|
||
description: "HotSwap: compile and reload the changed classes into the running Java debug session",
|
||
category: "Debug",
|
||
icon: "refresh",
|
||
keywords: ["hotswap", "hot swap", "hot code replace"],
|
||
when: "debugCanHotSwap",
|
||
run: ({ arg }) =>
|
||
reloadChangedClasses(
|
||
true,
|
||
typeof arg === "object" && arg !== null && "configId" in arg && typeof arg.configId === "string"
|
||
? arg.configId
|
||
: undefined,
|
||
),
|
||
},
|
||
{
|
||
id: "debug.memory.refresh",
|
||
title: "Refresh Memory View",
|
||
category: "Debug",
|
||
icon: "refresh",
|
||
keywords: ["memory", "heap", "instances", "classes"],
|
||
when: "debugHasJvmMemory",
|
||
run: () => {
|
||
const s = activeSession();
|
||
if (s && sessionSupports("jvmMemory", s)) void refreshMemory(s.id);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.heap.capture",
|
||
title: "Capture Heap Snapshot",
|
||
category: "Debug",
|
||
icon: "heap-snapshot",
|
||
keywords: ["memory", "heap", "dump", "snapshot"],
|
||
when: "debugHasJvmMemory",
|
||
run: () => {
|
||
const s = activeSession();
|
||
if (s && sessionSupports("jvmHeap", s)) void captureHeap(s.id);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.startPageProfile",
|
||
title: "Start CPU Profile",
|
||
description: "Record where the debugged page spends its time",
|
||
category: "Debug",
|
||
icon: "profile",
|
||
keywords: ["profiler", "performance", "flame graph", "browser"],
|
||
when: "debugHasJsPage && !debugPageProfiled",
|
||
run: () => startPageProfile(),
|
||
},
|
||
{
|
||
id: "debug.stopPageProfile",
|
||
title: "Stop CPU Profile",
|
||
description: "Stop recording the page and open the profile",
|
||
category: "Debug",
|
||
icon: "profile",
|
||
keywords: ["profiler", "performance", "flame graph", "browser"],
|
||
when: "debugPageProfiled",
|
||
run: () => stopPageProfile(),
|
||
},
|
||
{
|
||
// The host opens dumps for a trusted project only (F21).
|
||
id: "debug.heap.open",
|
||
title: "Open Heap Dump…",
|
||
category: "Debug",
|
||
icon: "heap-snapshot",
|
||
keywords: ["memory", "heap", "dump", "hprof", "snapshot"],
|
||
when: "projectOpen",
|
||
run: () => openHeapDump(),
|
||
},
|
||
{
|
||
id: "debug.heap.saveDump",
|
||
title: "Save Heap Dump As…",
|
||
category: "Debug",
|
||
icon: "export",
|
||
keywords: ["memory", "heap", "dump", "hprof", "snapshot"],
|
||
when: "debugHeapSnapshotCaptured",
|
||
run: () => {
|
||
const id = activeCapturedSnapshot();
|
||
if (id !== null) return saveHeapDump(id);
|
||
},
|
||
},
|
||
{
|
||
// Runs for the class given as `arg`, else the selected row of the Memory view.
|
||
id: "debug.memory.showInstances",
|
||
title: "Show Instances",
|
||
category: "Debug",
|
||
icon: "list",
|
||
keywords: ["memory", "heap", "objects", "instances"],
|
||
when: "debugSessionPaused",
|
||
run: ({ arg }) => {
|
||
const s = activeSession();
|
||
if (!s || !sessionSupports("jvmInstances", s)) return;
|
||
const name = typeof arg === "string" ? arg : useMemory.getState().bySession[s.id]?.selected;
|
||
if (name) void showInstances(s.id, name);
|
||
},
|
||
},
|
||
{
|
||
// Runs for the class given as `arg`, else the open instances list, else the selected Memory row.
|
||
// Needs only the project's language server, so it also works once the session has ended.
|
||
id: "debug.memory.jumpToSource",
|
||
title: "Jump to Source",
|
||
category: "Debug",
|
||
icon: "edit-source",
|
||
keywords: ["memory", "class", "instances"],
|
||
when: "projectOpen",
|
||
run: ({ arg }) => {
|
||
const s = activeSession();
|
||
const name =
|
||
typeof arg === "string"
|
||
? arg
|
||
: s &&
|
||
(useInstances.getState().bySession[s.id]?.className ?? useMemory.getState().bySession[s.id]?.selected);
|
||
if (name) void jumpToClass(name);
|
||
},
|
||
},
|
||
{
|
||
// Runs for the lead object row of the open instances list.
|
||
id: "debug.memory.showReferrers",
|
||
title: "Show Referrers",
|
||
category: "Debug",
|
||
icon: "hierarchy",
|
||
keywords: ["memory", "instances", "references", "referring objects"],
|
||
when: "debugSessionPaused",
|
||
run: () => {
|
||
const s = activeSession();
|
||
const entry = s && useInstances.getState().bySession[s.id];
|
||
if (!s || !entry?.lead || !sessionSupports("jvmInstances", s) || instancesOutdated(entry, s.stops)) return;
|
||
showReferrers(s.id, entry.lead.key, entry.lead.ref);
|
||
},
|
||
},
|
||
{
|
||
// Closes the pane of the session given as `arg`, else of the active one. No `when`: the pane stays
|
||
// after its session ends and must still close.
|
||
id: "debug.memory.closeInstances",
|
||
title: "Close Instances",
|
||
category: "Debug",
|
||
icon: "close",
|
||
keywords: ["memory", "instances"],
|
||
run: ({ arg }) => {
|
||
const id = typeof arg === "number" ? arg : activeSession()?.id;
|
||
if (id != null && useInstances.getState().bySession[id]) closeInstances(id);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.cancelHotSwap",
|
||
title: "Cancel Hot Swap Build",
|
||
description: "Stop the compile a Reload Changed Classes action is waiting on",
|
||
category: "Debug",
|
||
icon: "stop",
|
||
when: "debugHotSwapBuilding",
|
||
run: () => cancelHotSwapBuild(),
|
||
},
|
||
{
|
||
id: "debug.rerun",
|
||
title: "Rerun",
|
||
category: "Debug",
|
||
icon: "rerun",
|
||
when: "debugCanRerun",
|
||
// ⌘R / Ctrl+F5 rerun only in the Debug tool window (⌘R is Replace in the editor).
|
||
keyWhen: "activeToolWindow == 'debug'",
|
||
run: () => {
|
||
const s = activeSession();
|
||
if (s) void rerunSession(rootOf(s).id);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.resume",
|
||
title: "Resume Program",
|
||
category: "Debug",
|
||
icon: "resume",
|
||
when: paused,
|
||
run: () => {
|
||
const t = pausedTarget();
|
||
if (t)
|
||
void report(
|
||
tx("Resume failed"),
|
||
resumeExecution(t.s.id, () => call(commands.debugResume(t.s.id, t.thread))),
|
||
);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.pause",
|
||
title: "Pause Program",
|
||
category: "Debug",
|
||
icon: "pause",
|
||
// The trace resumes the program itself; a pause would suspend threads under the running trace.
|
||
when: "debugSessionRunning && !debugStreamTracing",
|
||
run: async () => {
|
||
const s = activeSession();
|
||
if (!s || s.status !== "running") return;
|
||
let thread = s.selectedThread ?? s.threads[0]?.id;
|
||
if (thread == null) {
|
||
const threads = await call(commands.debugThreads(s.id)).catch(() => []);
|
||
thread = threads[0]?.id ?? 0;
|
||
}
|
||
await report(tx("Pause failed"), call(commands.debugPause(s.id, thread)));
|
||
},
|
||
},
|
||
{
|
||
id: "debug.hotReload",
|
||
title: "Hot Reload",
|
||
category: "Debug",
|
||
icon: "hot-reload",
|
||
description: "Flutter: inject the changed sources into the running app",
|
||
when: "debugSessionRunning && debugSessionDart",
|
||
run: () => {
|
||
const s = activeSession();
|
||
if (s) void report("Hot Reload failed", call(commands.debugHotReload(s.id, "manual")));
|
||
},
|
||
},
|
||
{
|
||
id: "debug.hotRestart",
|
||
title: "Hot Restart",
|
||
category: "Debug",
|
||
icon: "refresh",
|
||
description: "Flutter: restart the app, discarding its state",
|
||
when: "debugSessionRunning && debugSessionDart",
|
||
run: () => {
|
||
const s = activeSession();
|
||
if (s) void report("Hot Restart failed", call(commands.debugHotRestart(s.id)));
|
||
},
|
||
},
|
||
{
|
||
id: "debug.openDevTools",
|
||
title: "Open Flutter DevTools in Browser",
|
||
category: "Debug",
|
||
icon: "external-link",
|
||
description: "Flutter: inspect the running app in the browser",
|
||
when: "debugHasVmService",
|
||
run: () => {
|
||
const s = activeSession();
|
||
const uri = s && rootOf(s).vmServiceUri;
|
||
if (uri) void report("Couldn't open Flutter DevTools", openDevTools(uri));
|
||
},
|
||
},
|
||
{
|
||
id: "debug.refreshDevTools",
|
||
title: "Refresh Flutter DevTools",
|
||
category: "Debug",
|
||
icon: "refresh",
|
||
description: "Flutter: load the DevTools page again",
|
||
when: "flutterDevTools",
|
||
run: (c) => {
|
||
const id = c.arg;
|
||
for (const w of DEVTOOLS_WINDOWS) if (!id || id === w.id) refreshDevTools(w.id);
|
||
},
|
||
},
|
||
step("debug.stepOver", "Step Over", "over", "step-over"),
|
||
step("debug.stepInto", "Step Into", "into", "step-into"),
|
||
step("debug.stepOut", "Step Out", "out", "step-out"),
|
||
{
|
||
id: "debug.forceStepOver",
|
||
title: "Force Step Over",
|
||
category: "Debug",
|
||
icon: "force-step-over",
|
||
description: "Step over, ignoring breakpoints in the called code",
|
||
when: paused,
|
||
run: () => {
|
||
const t = pausedTarget();
|
||
if (t)
|
||
void report(
|
||
tx("Force Step Over failed"),
|
||
resumeExecution(t.s.id, () => call(commands.debugForceStepOver(t.s.id, t.thread))),
|
||
);
|
||
},
|
||
},
|
||
{
|
||
// DAP has no "ignore stepping filters" flag: adapters step into what their
|
||
// launch options (justMyCode, skipFiles, stepFilters) allow.
|
||
id: "debug.forceStepInto",
|
||
title: "Force Step Into",
|
||
category: "Debug",
|
||
icon: "force-step-into",
|
||
when: paused,
|
||
run: () => {
|
||
const t = pausedTarget();
|
||
if (t)
|
||
void report(
|
||
tx("Force Step Into failed"),
|
||
resumeExecution(t.s.id, () => call(commands.debugStep(t.s.id, t.thread, "into"))),
|
||
);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.smartStepInto",
|
||
title: "Smart Step Into",
|
||
category: "Debug",
|
||
icon: "smart-step-into",
|
||
description: "Choose which call on the current line to step into",
|
||
when: paused,
|
||
run: () => void report(tx("Smart Step Into failed"), smartStepInto()),
|
||
},
|
||
{
|
||
id: "debug.showExecutionPoint",
|
||
title: "Show Execution Point",
|
||
category: "Debug",
|
||
icon: "show-execution-point",
|
||
when: "debugSessionPaused",
|
||
run: () => {
|
||
const s = activeSession();
|
||
if (s) void showExecutionPoint(s.id);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.resetFrame",
|
||
title: "Reset Frame",
|
||
category: "Debug",
|
||
icon: "reset-frame",
|
||
keywords: ["drop frame", "pop frame", "restart frame"],
|
||
description: "Return to the start of the selected frame's method",
|
||
when: paused,
|
||
run: () => {
|
||
const t = pausedTarget();
|
||
const frame = t && selectedFrame(t.s);
|
||
if (!t || !frame) return;
|
||
if (!sessionSupports("restartFrame", t.s)) {
|
||
notSupported("Reset Frame", t.s);
|
||
return;
|
||
}
|
||
void report(
|
||
tx("Reset Frame failed"),
|
||
resumeExecution(t.s.id, () => call(commands.debugRestartFrame(t.s.id, frame.id))),
|
||
);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.setValue",
|
||
title: "Set Value…",
|
||
category: "Debug",
|
||
icon: "edit",
|
||
keyWhen: "debugVariablesFocus",
|
||
when: paused,
|
||
run: () => focusedDebugView()?.setValue?.(),
|
||
},
|
||
{
|
||
id: "debug.jumpToSource",
|
||
title: "Jump to Source",
|
||
category: "Debug",
|
||
keyWhen: "debugFramesFocus || debugVariablesFocus",
|
||
when: "debugSessionPaused",
|
||
run: () => {
|
||
const view = focusedDebugView();
|
||
if (view?.jumpToSource) {
|
||
view.jumpToSource();
|
||
return;
|
||
}
|
||
const s = activeSession();
|
||
const frame = s && selectedFrame(s);
|
||
if (frame) void revealFrame(frame, true);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.attachToProcess",
|
||
title: "Attach to Process…",
|
||
category: "Debug",
|
||
icon: "attach-to-process",
|
||
description: "Attach the debugger to a running Java, Node.js, Python, Go or native process",
|
||
run: () => void openAttachPopup(),
|
||
},
|
||
{
|
||
id: "debug.attachUnity",
|
||
title: "Attach to Unity Process",
|
||
category: "Run",
|
||
icon: "debug",
|
||
hidden: true,
|
||
when: "projectOpen",
|
||
run: ({ arg }) => openAttachPopup("unity", arg as RunConfig | undefined),
|
||
},
|
||
{
|
||
id: "debug.debugInBrowser",
|
||
title: "Debug in Browser",
|
||
category: "Debug",
|
||
icon: "browser-chrome",
|
||
description: "Opens a URL in Chrome or Edge with the debugger attached (arg: the URL).",
|
||
hidden: true,
|
||
run: ({ arg }) => void debugInBrowser(arg),
|
||
},
|
||
{
|
||
id: "debug.runToCursor",
|
||
title: "Run to Cursor",
|
||
category: "Debug",
|
||
icon: "run-to-cursor",
|
||
when: paused,
|
||
run: () => {
|
||
const t = pausedTarget();
|
||
const c = cursor();
|
||
if (t && c && breakpointPathAllowed(c.path))
|
||
void report(
|
||
tx("Run to Cursor failed"),
|
||
resumeExecution(t.s.id, () => call(commands.debugRunTo(t.s.id, t.thread, c.path, c.line, false))),
|
||
);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.forceRunToCursor",
|
||
title: "Force Run to Cursor",
|
||
category: "Debug",
|
||
icon: "force-run-to-cursor",
|
||
description: "Run to the caret, ignoring breakpoints on the way",
|
||
when: paused,
|
||
run: () => {
|
||
const t = pausedTarget();
|
||
const c = cursor();
|
||
if (t && c && breakpointPathAllowed(c.path))
|
||
void report(
|
||
tx("Force Run to Cursor failed"),
|
||
resumeExecution(t.s.id, () => call(commands.debugRunTo(t.s.id, t.thread, c.path, c.line, true))),
|
||
);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.toggleBreakpoint",
|
||
title: "Toggle Line Breakpoint",
|
||
category: "Debug",
|
||
icon: "breakpoint",
|
||
run: () => {
|
||
const c = cursor();
|
||
if (!c || !breakpointPathAllowed(c.path)) return;
|
||
const exists = useBreakpoints.getState().byFile[c.path]?.some((b) => b.line === c.line);
|
||
const language = activeEditor()?.ctx.language ?? "";
|
||
if (!exists && !canPlaceBreakpoint(language)) {
|
||
notifications().notify({
|
||
level: "info",
|
||
key: "debug.breakpointNotAllowed",
|
||
title: "Breakpoints can't be placed in this file",
|
||
body: "Enable Settings › Build, Execution, Deployment › Debugger › Allow placing breakpoints in any file.",
|
||
});
|
||
return;
|
||
}
|
||
const ed = activeEditor();
|
||
// Like IDEA, no new breakpoint on a blank or comment-only line; an existing one still goes.
|
||
const taken = exists || specialAt(c.path).some((b) => b.line === c.line);
|
||
if (!taken && ed && !lineHasCode(ed.view.state, c.line)) return;
|
||
if (ed) toggleBreakpointSmart(c.path, c.line, language, ed.view.state.doc.toString());
|
||
else toggleBreakpoint(c.path, c.line);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.toggleTemporaryBreakpoint",
|
||
title: "Toggle Temporary Line Breakpoint",
|
||
category: "Debug",
|
||
icon: "breakpoint",
|
||
description: "A line breakpoint that is removed after it is hit",
|
||
run: () => {
|
||
const c = cursor();
|
||
const ed = activeEditor();
|
||
if (!c || !breakpointPathAllowed(c.path) || !canPlaceBreakpoint(ed?.ctx.language ?? "", c.path)) return;
|
||
const exists = useBreakpoints.getState().byFile[c.path]?.some((b) => b.line === c.line);
|
||
if (!exists && ed && !lineHasCode(ed.view.state, c.line)) return;
|
||
toggleTemporaryBreakpoint(c.path, c.line);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.toggleMethodBreakpoint",
|
||
title: "Toggle Method Breakpoint",
|
||
category: "Debug",
|
||
icon: "breakpoint-method",
|
||
run: () => {
|
||
const ed = activeEditor();
|
||
const c = cursor();
|
||
if (!ed || !c || !breakpointPathAllowed(c.path)) return;
|
||
const existing = specialAt(c.path).find((b) => b.kind === "method" && b.line === c.line);
|
||
const method = methodAt(ed.ctx.language, ed.view.state.doc.toString(), c.line);
|
||
if (!existing && !method) {
|
||
notifications().notify({
|
||
level: "info",
|
||
key: "debug.noMethod",
|
||
title: "No method declaration on this line",
|
||
body: "Put the caret on a method declaration, or add a method breakpoint by name in View Breakpoints.",
|
||
});
|
||
return;
|
||
}
|
||
toggleMethodAt(c.path, c.line, method?.name ?? "");
|
||
},
|
||
},
|
||
{
|
||
id: "debug.toggleFieldWatchpoint",
|
||
title: "Toggle Field Watchpoint",
|
||
category: "Debug",
|
||
icon: "breakpoint-field",
|
||
run: () => {
|
||
const ed = activeEditor();
|
||
const c = cursor();
|
||
if (!ed || !c || !breakpointPathAllowed(c.path)) return;
|
||
const existing = specialAt(c.path).find((b) => b.kind === "field" && b.line === c.line);
|
||
const field = fieldAt(ed.ctx.language, ed.view.state.doc.toString(), c.line);
|
||
if (!existing && !field) {
|
||
notifications().notify({
|
||
level: "info",
|
||
key: "debug.noField",
|
||
title: "No field declaration on this line",
|
||
body: "Field watchpoints can be set on Java field declarations, or from the Variables view while suspended.",
|
||
});
|
||
return;
|
||
}
|
||
toggleFieldAt(c.path, c.line, field ?? { dataId: "", label: "" });
|
||
},
|
||
},
|
||
{
|
||
id: "debug.viewBreakpoints",
|
||
title: "View Breakpoints…",
|
||
category: "Debug",
|
||
icon: "breakpoint",
|
||
run: () => {
|
||
const c = cursor();
|
||
const bp = c ? useBreakpoints.getState().byFile[c.path]?.find((b) => b.line === c.line) : undefined;
|
||
openBreakpointsDialog(c && bp ? { path: c.path, id: bp.id } : undefined);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.muteBreakpoints",
|
||
title: "Mute Breakpoints",
|
||
category: "Debug",
|
||
keywords: ["unmute", "disable all"],
|
||
toggled: () => useBreakpoints.getState().muted,
|
||
run: () => setMuted(!useBreakpoints.getState().muted),
|
||
},
|
||
{
|
||
id: "debug.removeAllBreakpoints",
|
||
title: "Remove All Breakpoints",
|
||
category: "Debug",
|
||
run: () => {
|
||
removeAllBreakpoints();
|
||
removeAllSpecial();
|
||
},
|
||
},
|
||
{
|
||
id: "debug.evaluate",
|
||
title: "Evaluate Expression…",
|
||
category: "Debug",
|
||
when: "debugSessionActive",
|
||
run: () => openEvaluateDialog(evaluateSeed()),
|
||
},
|
||
{
|
||
id: "debug.traceStreamChain",
|
||
title: "Trace Stream Chain",
|
||
category: "Debug",
|
||
icon: "stream-trace",
|
||
keywords: ["stream", "chain", "trace", "java"],
|
||
when: "debugCanTraceStream",
|
||
run: () => {
|
||
const t = pausedTarget();
|
||
if (t) void report(tx("Trace Stream Chain failed"), traceStreamChain(t.s.id));
|
||
},
|
||
},
|
||
{
|
||
// The trace tab passes its session as `arg`.
|
||
id: "debug.streamTrace.stopRecording",
|
||
title: "Stop Recording",
|
||
category: "Debug",
|
||
keywords: ["stream", "trace"],
|
||
when: "debugAnyStreamTracing",
|
||
enabled: ({ arg }) => {
|
||
const id = traceTarget(arg);
|
||
return id != null && isTracing(id) && !useStreamTrace.getState().bySession[id]?.stoppedRecording;
|
||
},
|
||
run: ({ arg }) => {
|
||
const id = traceTarget(arg);
|
||
if (id != null) stopRecording(id);
|
||
},
|
||
},
|
||
{
|
||
id: "debug.streamTrace.abort",
|
||
title: "Abort Operation…",
|
||
category: "Debug",
|
||
keywords: ["stream", "trace", "cancel"],
|
||
when: "debugAnyStreamTracing",
|
||
enabled: ({ arg }) => {
|
||
const id = traceTarget(arg);
|
||
return id != null && isTracing(id);
|
||
},
|
||
run: ({ arg }) => {
|
||
const id = traceTarget(arg);
|
||
if (id != null) useOverlays.setState({ streamAbort: id });
|
||
},
|
||
},
|
||
{
|
||
id: "debug.browseConsoleHistory",
|
||
title: "Browse Console History",
|
||
category: "Debug",
|
||
keywords: ["history", "previous expressions", "repl"],
|
||
when: "debugSessionActive",
|
||
run: () => {
|
||
if (!browseFocusedConsoleHistory()) showStatusInfo(tx("Focus the debug console input first"));
|
||
},
|
||
},
|
||
{
|
||
// ⌥⌘F8: the selection (or expression at the caret) evaluated in a value hint, no dialog.
|
||
id: "debug.quickEvaluate",
|
||
title: "Quick Evaluate Expression",
|
||
category: "Debug",
|
||
when: "debugSessionPaused && textEditorActive",
|
||
run: ({ arg }) => quickEvaluate(arg),
|
||
},
|
||
{
|
||
id: "debug.showToolWindow",
|
||
title: "Show Debug Tool Window",
|
||
category: "Debug",
|
||
hidden: true,
|
||
run: () => toolWindowService().show("debug", true),
|
||
},
|
||
]);
|
||
}
|