Path: blob/main/src/vs/workbench/contrib/debug/common/debug.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { IAction } from '../../../../base/common/actions.js';6import { VSBuffer } from '../../../../base/common/buffer.js';7import { CancellationToken } from '../../../../base/common/cancellation.js';8import { Color } from '../../../../base/common/color.js';9import { Event } from '../../../../base/common/event.js';10import { IJSONSchemaSnippet } from '../../../../base/common/jsonSchema.js';11import { IDisposable } from '../../../../base/common/lifecycle.js';12import severity from '../../../../base/common/severity.js';13import { URI, UriComponents, URI as uri } from '../../../../base/common/uri.js';14import { IPosition, Position } from '../../../../editor/common/core/position.js';15import { IRange } from '../../../../editor/common/core/range.js';16import * as editorCommon from '../../../../editor/common/editorCommon.js';17import { ITextModel as EditorIModel } from '../../../../editor/common/model.js';18import * as nls from '../../../../nls.js';19import { ConfigurationTarget } from '../../../../platform/configuration/common/configuration.js';20import { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';21import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';22import { ITelemetryEndpoint } from '../../../../platform/telemetry/common/telemetry.js';23import { IWorkspaceFolder } from '../../../../platform/workspace/common/workspace.js';24import { IEditorPane } from '../../../common/editor.js';25import { DebugCompoundRoot } from './debugCompoundRoot.js';26import { IDataBreakpointOptions, IFunctionBreakpointOptions, IInstructionBreakpointOptions } from './debugModel.js';27import { Source } from './debugSource.js';28import { ITaskIdentifier } from '../../tasks/common/tasks.js';29import { LiveTestResult } from '../../testing/common/testResult.js';30import { IEditorService } from '../../../services/editor/common/editorService.js';31import { IView } from '../../../common/views.js';3233export const VIEWLET_ID = 'workbench.view.debug';3435export const VARIABLES_VIEW_ID = 'workbench.debug.variablesView';36export const WATCH_VIEW_ID = 'workbench.debug.watchExpressionsView';37export const CALLSTACK_VIEW_ID = 'workbench.debug.callStackView';38export const LOADED_SCRIPTS_VIEW_ID = 'workbench.debug.loadedScriptsView';39export const BREAKPOINTS_VIEW_ID = 'workbench.debug.breakPointsView';40export const DISASSEMBLY_VIEW_ID = 'workbench.debug.disassemblyView';41export const DEBUG_PANEL_ID = 'workbench.panel.repl';42export const REPL_VIEW_ID = 'workbench.panel.repl.view';43export const CONTEXT_DEBUG_TYPE = new RawContextKey<string>('debugType', undefined, { type: 'string', description: nls.localize('debugType', "Debug type of the active debug session. For example 'python'.") });44export const CONTEXT_DEBUG_CONFIGURATION_TYPE = new RawContextKey<string>('debugConfigurationType', undefined, { type: 'string', description: nls.localize('debugConfigurationType', "Debug type of the selected launch configuration. For example 'python'.") });45export const CONTEXT_DEBUG_STATE = new RawContextKey<string>('debugState', 'inactive', { type: 'string', description: nls.localize('debugState', "State that the focused debug session is in. One of the following: 'inactive', 'initializing', 'stopped' or 'running'.") });46export const CONTEXT_DEBUG_UX_KEY = 'debugUx';47export const CONTEXT_DEBUG_UX = new RawContextKey<string>(CONTEXT_DEBUG_UX_KEY, 'default', { type: 'string', description: nls.localize('debugUX', "Debug UX state. When there are no debug configurations it is 'simple', otherwise 'default'. Used to decide when to show welcome views in the debug viewlet.") });48export const CONTEXT_HAS_DEBUGGED = new RawContextKey<boolean>('hasDebugged', false, { type: 'boolean', description: nls.localize('hasDebugged', "True when a debug session has been started at least once, false otherwise.") });49export const CONTEXT_IN_DEBUG_MODE = new RawContextKey<boolean>('inDebugMode', false, { type: 'boolean', description: nls.localize('inDebugMode', "True when debugging, false otherwise.") });50export const CONTEXT_IN_DEBUG_REPL = new RawContextKey<boolean>('inDebugRepl', false, { type: 'boolean', description: nls.localize('inDebugRepl', "True when focus is in the debug console, false otherwise.") });51export const CONTEXT_BREAKPOINT_WIDGET_VISIBLE = new RawContextKey<boolean>('breakpointWidgetVisible', false, { type: 'boolean', description: nls.localize('breakpointWidgetVisibile', "True when breakpoint editor zone widget is visible, false otherwise.") });52export const CONTEXT_IN_BREAKPOINT_WIDGET = new RawContextKey<boolean>('inBreakpointWidget', false, { type: 'boolean', description: nls.localize('inBreakpointWidget', "True when focus is in the breakpoint editor zone widget, false otherwise.") });53export const CONTEXT_BREAKPOINTS_FOCUSED = new RawContextKey<boolean>('breakpointsFocused', true, { type: 'boolean', description: nls.localize('breakpointsFocused', "True when the BREAKPOINTS view is focused, false otherwise.") });54export const CONTEXT_WATCH_EXPRESSIONS_FOCUSED = new RawContextKey<boolean>('watchExpressionsFocused', true, { type: 'boolean', description: nls.localize('watchExpressionsFocused', "True when the WATCH view is focused, false otherwise.") });55export const CONTEXT_WATCH_EXPRESSIONS_EXIST = new RawContextKey<boolean>('watchExpressionsExist', false, { type: 'boolean', description: nls.localize('watchExpressionsExist', "True when at least one watch expression exists, false otherwise.") });56export const CONTEXT_VARIABLES_FOCUSED = new RawContextKey<boolean>('variablesFocused', true, { type: 'boolean', description: nls.localize('variablesFocused', "True when the VARIABLES views is focused, false otherwise") });57export const CONTEXT_EXPRESSION_SELECTED = new RawContextKey<boolean>('expressionSelected', false, { type: 'boolean', description: nls.localize('expressionSelected', "True when an expression input box is open in either the WATCH or the VARIABLES view, false otherwise.") });58export const CONTEXT_BREAKPOINT_INPUT_FOCUSED = new RawContextKey<boolean>('breakpointInputFocused', false, { type: 'boolean', description: nls.localize('breakpointInputFocused', "True when the input box has focus in the BREAKPOINTS view.") });59export const CONTEXT_CALLSTACK_ITEM_TYPE = new RawContextKey<string>('callStackItemType', undefined, { type: 'string', description: nls.localize('callStackItemType', "Represents the item type of the focused element in the CALL STACK view. For example: 'session', 'thread', 'stackFrame'") });60export const CONTEXT_CALLSTACK_SESSION_IS_ATTACH = new RawContextKey<boolean>('callStackSessionIsAttach', false, { type: 'boolean', description: nls.localize('callStackSessionIsAttach', "True when the session in the CALL STACK view is attach, false otherwise. Used internally for inline menus in the CALL STACK view.") });61export const CONTEXT_CALLSTACK_ITEM_STOPPED = new RawContextKey<boolean>('callStackItemStopped', false, { type: 'boolean', description: nls.localize('callStackItemStopped', "True when the focused item in the CALL STACK is stopped. Used internaly for inline menus in the CALL STACK view.") });62export const CONTEXT_CALLSTACK_SESSION_HAS_ONE_THREAD = new RawContextKey<boolean>('callStackSessionHasOneThread', false, { type: 'boolean', description: nls.localize('callStackSessionHasOneThread', "True when the focused session in the CALL STACK view has exactly one thread. Used internally for inline menus in the CALL STACK view.") });63export const CONTEXT_CALLSTACK_FOCUSED = new RawContextKey<boolean>('callStackFocused', true, { type: 'boolean', description: nls.localize('callStackFocused', "True when the CALLSTACK view is focused, false otherwise.") });64export const CONTEXT_WATCH_ITEM_TYPE = new RawContextKey<string>('watchItemType', undefined, { type: 'string', description: nls.localize('watchItemType', "Represents the item type of the focused element in the WATCH view. For example: 'expression', 'variable'") });65export const CONTEXT_CAN_VIEW_MEMORY = new RawContextKey<boolean>('canViewMemory', undefined, { type: 'boolean', description: nls.localize('canViewMemory', "Indicates whether the item in the view has an associated memory refrence.") });66export const CONTEXT_BREAKPOINT_ITEM_TYPE = new RawContextKey<string>('breakpointItemType', undefined, { type: 'string', description: nls.localize('breakpointItemType', "Represents the item type of the focused element in the BREAKPOINTS view. For example: 'breakpoint', 'exceptionBreakppint', 'functionBreakpoint', 'dataBreakpoint'") });67export const CONTEXT_BREAKPOINT_ITEM_IS_DATA_BYTES = new RawContextKey<boolean>('breakpointItemBytes', undefined, { type: 'boolean', description: nls.localize('breakpointItemIsDataBytes', "Whether the breakpoint item is a data breakpoint on a byte range.") });68export const CONTEXT_BREAKPOINT_HAS_MODES = new RawContextKey<boolean>('breakpointHasModes', false, { type: 'boolean', description: nls.localize('breakpointHasModes', "Whether the breakpoint has multiple modes it can switch to.") });69export const CONTEXT_BREAKPOINT_SUPPORTS_CONDITION = new RawContextKey<boolean>('breakpointSupportsCondition', false, { type: 'boolean', description: nls.localize('breakpointSupportsCondition', "True when the focused breakpoint supports conditions.") });70export const CONTEXT_LOADED_SCRIPTS_SUPPORTED = new RawContextKey<boolean>('loadedScriptsSupported', false, { type: 'boolean', description: nls.localize('loadedScriptsSupported', "True when the focused sessions supports the LOADED SCRIPTS view") });71export const CONTEXT_LOADED_SCRIPTS_ITEM_TYPE = new RawContextKey<string>('loadedScriptsItemType', undefined, { type: 'string', description: nls.localize('loadedScriptsItemType', "Represents the item type of the focused element in the LOADED SCRIPTS view.") });72export const CONTEXT_FOCUSED_SESSION_IS_ATTACH = new RawContextKey<boolean>('focusedSessionIsAttach', false, { type: 'boolean', description: nls.localize('focusedSessionIsAttach', "True when the focused session is 'attach'.") });73export const CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG = new RawContextKey<boolean>('focusedSessionIsNoDebug', false, { type: 'boolean', description: nls.localize('focusedSessionIsNoDebug', "True when the focused session is run without debugging.") });74export const CONTEXT_STEP_BACK_SUPPORTED = new RawContextKey<boolean>('stepBackSupported', false, { type: 'boolean', description: nls.localize('stepBackSupported', "True when the focused session supports 'stepBack' requests.") });75export const CONTEXT_RESTART_FRAME_SUPPORTED = new RawContextKey<boolean>('restartFrameSupported', false, { type: 'boolean', description: nls.localize('restartFrameSupported', "True when the focused session supports 'restartFrame' requests.") });76export const CONTEXT_STACK_FRAME_SUPPORTS_RESTART = new RawContextKey<boolean>('stackFrameSupportsRestart', false, { type: 'boolean', description: nls.localize('stackFrameSupportsRestart', "True when the focused stack frame supports 'restartFrame'.") });77export const CONTEXT_JUMP_TO_CURSOR_SUPPORTED = new RawContextKey<boolean>('jumpToCursorSupported', false, { type: 'boolean', description: nls.localize('jumpToCursorSupported', "True when the focused session supports 'jumpToCursor' request.") });78export const CONTEXT_STEP_INTO_TARGETS_SUPPORTED = new RawContextKey<boolean>('stepIntoTargetsSupported', false, { type: 'boolean', description: nls.localize('stepIntoTargetsSupported', "True when the focused session supports 'stepIntoTargets' request.") });79export const CONTEXT_BREAKPOINTS_EXIST = new RawContextKey<boolean>('breakpointsExist', false, { type: 'boolean', description: nls.localize('breakpointsExist', "True when at least one breakpoint exists.") });80export const CONTEXT_DEBUGGERS_AVAILABLE = new RawContextKey<boolean>('debuggersAvailable', false, { type: 'boolean', description: nls.localize('debuggersAvailable', "True when there is at least one debug extensions active.") });81export const CONTEXT_DEBUG_EXTENSION_AVAILABLE = new RawContextKey<boolean>('debugExtensionAvailable', true, { type: 'boolean', description: nls.localize('debugExtensionsAvailable', "True when there is at least one debug extension installed and enabled.") });82export const CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT = new RawContextKey<string>('debugProtocolVariableMenuContext', undefined, { type: 'string', description: nls.localize('debugProtocolVariableMenuContext', "Represents the context the debug adapter sets on the focused variable in the VARIABLES view.") });83export const CONTEXT_SET_VARIABLE_SUPPORTED = new RawContextKey<boolean>('debugSetVariableSupported', false, { type: 'boolean', description: nls.localize('debugSetVariableSupported', "True when the focused session supports 'setVariable' request.") });84export const CONTEXT_SET_DATA_BREAKPOINT_BYTES_SUPPORTED = new RawContextKey<boolean>('debugSetDataBreakpointAddressSupported', false, { type: 'boolean', description: nls.localize('debugSetDataBreakpointAddressSupported', "True when the focused session supports 'getBreakpointInfo' request on an address.") });85export const CONTEXT_SET_EXPRESSION_SUPPORTED = new RawContextKey<boolean>('debugSetExpressionSupported', false, { type: 'boolean', description: nls.localize('debugSetExpressionSupported', "True when the focused session supports 'setExpression' request.") });86export const CONTEXT_BREAK_WHEN_VALUE_CHANGES_SUPPORTED = new RawContextKey<boolean>('breakWhenValueChangesSupported', false, { type: 'boolean', description: nls.localize('breakWhenValueChangesSupported', "True when the focused session supports to break when value changes.") });87export const CONTEXT_BREAK_WHEN_VALUE_IS_ACCESSED_SUPPORTED = new RawContextKey<boolean>('breakWhenValueIsAccessedSupported', false, { type: 'boolean', description: nls.localize('breakWhenValueIsAccessedSupported', "True when the focused breakpoint supports to break when value is accessed.") });88export const CONTEXT_BREAK_WHEN_VALUE_IS_READ_SUPPORTED = new RawContextKey<boolean>('breakWhenValueIsReadSupported', false, { type: 'boolean', description: nls.localize('breakWhenValueIsReadSupported', "True when the focused breakpoint supports to break when value is read.") });89export const CONTEXT_TERMINATE_DEBUGGEE_SUPPORTED = new RawContextKey<boolean>('terminateDebuggeeSupported', false, { type: 'boolean', description: nls.localize('terminateDebuggeeSupported', "True when the focused session supports the terminate debuggee capability.") });90export const CONTEXT_SUSPEND_DEBUGGEE_SUPPORTED = new RawContextKey<boolean>('suspendDebuggeeSupported', false, { type: 'boolean', description: nls.localize('suspendDebuggeeSupported', "True when the focused session supports the suspend debuggee capability.") });91export const CONTEXT_TERMINATE_THREADS_SUPPORTED = new RawContextKey<boolean>('terminateThreadsSupported', false, { type: 'boolean', description: nls.localize('terminateThreadsSupported', "True when the focused session supports the terminate threads capability.") });92export const CONTEXT_VARIABLE_EVALUATE_NAME_PRESENT = new RawContextKey<boolean>('variableEvaluateNamePresent', false, { type: 'boolean', description: nls.localize('variableEvaluateNamePresent', "True when the focused variable has an 'evalauteName' field set.") });93export const CONTEXT_VARIABLE_IS_READONLY = new RawContextKey<boolean>('variableIsReadonly', false, { type: 'boolean', description: nls.localize('variableIsReadonly', "True when the focused variable is read-only.") });94export const CONTEXT_VARIABLE_VALUE = new RawContextKey<boolean>('variableValue', false, { type: 'string', description: nls.localize('variableValue', "Value of the variable, present for debug visualization clauses.") });95export const CONTEXT_VARIABLE_TYPE = new RawContextKey<boolean>('variableType', false, { type: 'string', description: nls.localize('variableType', "Type of the variable, present for debug visualization clauses.") });96export const CONTEXT_VARIABLE_INTERFACES = new RawContextKey<boolean>('variableInterfaces', false, { type: 'array', description: nls.localize('variableInterfaces', "Any interfaces or contracts that the variable satisfies, present for debug visualization clauses.") });97export const CONTEXT_VARIABLE_NAME = new RawContextKey<boolean>('variableName', false, { type: 'string', description: nls.localize('variableName', "Name of the variable, present for debug visualization clauses.") });98export const CONTEXT_VARIABLE_LANGUAGE = new RawContextKey<boolean>('variableLanguage', false, { type: 'string', description: nls.localize('variableLanguage', "Language of the variable source, present for debug visualization clauses.") });99export const CONTEXT_VARIABLE_EXTENSIONID = new RawContextKey<boolean>('variableExtensionId', false, { type: 'string', description: nls.localize('variableExtensionId', "Extension ID of the variable source, present for debug visualization clauses.") });100export const CONTEXT_EXCEPTION_WIDGET_VISIBLE = new RawContextKey<boolean>('exceptionWidgetVisible', false, { type: 'boolean', description: nls.localize('exceptionWidgetVisible', "True when the exception widget is visible.") });101export const CONTEXT_MULTI_SESSION_REPL = new RawContextKey<boolean>('multiSessionRepl', false, { type: 'boolean', description: nls.localize('multiSessionRepl', "True when there is more than 1 debug console.") });102export const CONTEXT_MULTI_SESSION_DEBUG = new RawContextKey<boolean>('multiSessionDebug', false, { type: 'boolean', description: nls.localize('multiSessionDebug', "True when there is more than 1 active debug session.") });103export const CONTEXT_DISASSEMBLE_REQUEST_SUPPORTED = new RawContextKey<boolean>('disassembleRequestSupported', false, { type: 'boolean', description: nls.localize('disassembleRequestSupported', "True when the focused sessions supports disassemble request.") });104export const CONTEXT_DISASSEMBLY_VIEW_FOCUS = new RawContextKey<boolean>('disassemblyViewFocus', false, { type: 'boolean', description: nls.localize('disassemblyViewFocus', "True when the Disassembly View is focused.") });105export const CONTEXT_LANGUAGE_SUPPORTS_DISASSEMBLE_REQUEST = new RawContextKey<boolean>('languageSupportsDisassembleRequest', false, { type: 'boolean', description: nls.localize('languageSupportsDisassembleRequest', "True when the language in the current editor supports disassemble request.") });106export const CONTEXT_FOCUSED_STACK_FRAME_HAS_INSTRUCTION_POINTER_REFERENCE = new RawContextKey<boolean>('focusedStackFrameHasInstructionReference', false, { type: 'boolean', description: nls.localize('focusedStackFrameHasInstructionReference', "True when the focused stack frame has instruction pointer reference.") });107108export const debuggerDisabledMessage = (debugType: string) => nls.localize('debuggerDisabled', "Configured debug type '{0}' is installed but not supported in this environment.", debugType);109110export const EDITOR_CONTRIBUTION_ID = 'editor.contrib.debug';111export const BREAKPOINT_EDITOR_CONTRIBUTION_ID = 'editor.contrib.breakpoint';112export const DEBUG_SCHEME = 'debug';113export const INTERNAL_CONSOLE_OPTIONS_SCHEMA = {114enum: ['neverOpen', 'openOnSessionStart', 'openOnFirstSessionStart'],115default: 'openOnFirstSessionStart',116description: nls.localize('internalConsoleOptions', "Controls when the internal Debug Console should open.")117};118119export interface IDebugViewWithVariables extends IView {120readonly treeSelection: IExpression[];121}122123// raw124125export interface IRawModelUpdate {126sessionId: string;127threads: DebugProtocol.Thread[];128stoppedDetails?: IRawStoppedDetails;129}130131export interface IRawStoppedDetails {132reason?: string;133description?: string;134threadId?: number;135text?: string;136totalFrames?: number;137allThreadsStopped?: boolean;138preserveFocusHint?: boolean;139framesErrorMessage?: string;140hitBreakpointIds?: number[];141}142143// model144145export interface ITreeElement {146getId(): string;147}148149export interface IReplElement extends ITreeElement {150toString(includeSource?: boolean): string;151readonly sourceData?: IReplElementSource;152}153154export interface INestingReplElement extends IReplElement {155readonly hasChildren: boolean;156getChildren(): Promise<IReplElement[]> | IReplElement[];157}158159export interface IReplElementSource {160readonly source: Source;161readonly lineNumber: number;162readonly column: number;163}164165export interface IExpressionValue {166readonly value: string;167readonly type?: string;168valueChanged?: boolean;169}170171export interface IExpressionContainer extends ITreeElement, IExpressionValue {172readonly hasChildren: boolean;173getSession(): IDebugSession | undefined;174evaluateLazy(): Promise<void>;175getChildren(): Promise<IExpression[]>;176readonly reference?: number;177readonly memoryReference?: string;178readonly presentationHint?: DebugProtocol.VariablePresentationHint | undefined;179readonly valueLocationReference?: number;180}181182export interface IExpression extends IExpressionContainer {183name: string;184}185186export interface IDebugger {187readonly type: string;188createDebugAdapter(session: IDebugSession): Promise<IDebugAdapter>;189runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, sessionId: string): Promise<number | undefined>;190startDebugging(args: IConfig, parentSessionId: string): Promise<boolean>;191getCustomTelemetryEndpoint(): ITelemetryEndpoint | undefined;192getInitialConfigurationContent(initialConfigs?: IConfig[]): Promise<string>;193}194195export interface IDebuggerMetadata {196label: string;197type: string;198strings?: { [key in DebuggerString]: string };199interestedInLanguage(languageId: string): boolean;200}201202export const enum State {203Inactive,204Initializing,205Stopped,206Running207}208209export function getStateLabel(state: State): string {210switch (state) {211case State.Initializing: return 'initializing';212case State.Stopped: return 'stopped';213case State.Running: return 'running';214default: return 'inactive';215}216}217218export interface AdapterEndEvent {219error?: Error;220sessionLengthInSeconds: number;221emittedStopped: boolean;222}223224export interface LoadedSourceEvent {225reason: 'new' | 'changed' | 'removed';226source: Source;227}228229export type IDebugSessionReplMode = 'separate' | 'mergeWithParent';230231export interface IDebugTestRunReference {232runId: string;233taskId: string;234}235236export interface IDebugSessionOptions {237noDebug?: boolean;238parentSession?: IDebugSession;239lifecycleManagedByParent?: boolean;240repl?: IDebugSessionReplMode;241compoundRoot?: DebugCompoundRoot;242compact?: boolean;243startedByUser?: boolean;244saveBeforeRestart?: boolean;245suppressDebugToolbar?: boolean;246suppressDebugStatusbar?: boolean;247suppressDebugView?: boolean;248/**249* Set if the debug session is correlated with a test run. Stopping/restarting250* the session will instead stop/restart the test run.251*/252testRun?: IDebugTestRunReference;253}254255export interface IDataBreakpointInfoResponse {256dataId: string | null;257description: string;258canPersist?: boolean;259accessTypes?: DebugProtocol.DataBreakpointAccessType[];260}261262export interface IMemoryInvalidationEvent {263fromOffset: number;264toOffset: number;265}266267export const enum MemoryRangeType {268Valid,269Unreadable,270Error,271}272273export interface IMemoryRange {274type: MemoryRangeType;275offset: number;276length: number;277}278279export interface IValidMemoryRange extends IMemoryRange {280type: MemoryRangeType.Valid;281offset: number;282length: number;283data: VSBuffer;284}285286export interface IUnreadableMemoryRange extends IMemoryRange {287type: MemoryRangeType.Unreadable;288}289290export interface IErrorMemoryRange extends IMemoryRange {291type: MemoryRangeType.Error;292error: string;293}294295/**296* Union type of memory that can be returned from read(). Since a read request297* could encompass multiple previously-read ranges, multiple of these types298* are possible to return.299*/300export type MemoryRange = IValidMemoryRange | IUnreadableMemoryRange | IErrorMemoryRange;301302export const DEBUG_MEMORY_SCHEME = 'vscode-debug-memory';303304/**305* An IMemoryRegion corresponds to a contiguous range of memory referred to306* by a DAP `memoryReference`.307*/308export interface IMemoryRegion extends IDisposable {309/**310* Event that fires when memory changes. Can be a result of memory events or311* `write` requests.312*/313readonly onDidInvalidate: Event<IMemoryInvalidationEvent>;314315/**316* Whether writes are supported on this memory region.317*/318readonly writable: boolean;319320/**321* Requests memory ranges from the debug adapter. It returns a list of memory322* ranges that overlap (but may exceed!) the given offset. Use the `offset`323* and `length` of each range for display.324*/325read(fromOffset: number, toOffset: number): Promise<MemoryRange[]>;326327/**328* Writes memory to the debug adapter at the given offset.329*/330write(offset: number, data: VSBuffer): Promise<number>;331}332333/** Data that can be inserted in {@link IDebugSession.appendToRepl} */334export interface INewReplElementData {335/**336* Output string to display337*/338output: string;339340/**341* Expression data to display. Will result in the item being expandable in342* the REPL. Its value will be used if {@link output} is not provided.343*/344expression?: IExpression;345346/**347* Output severity.348*/349sev: severity;350351/**352* Originating location.353*/354source?: IReplElementSource;355}356357export interface IDebugEvaluatePosition {358line: number;359column: number;360source: DebugProtocol.Source;361}362363export interface IDebugLocationReferenced {364line: number;365column: number;366endLine?: number;367endColumn?: number;368source: Source;369}370371export interface IDebugSession extends ITreeElement, IDisposable {372373readonly configuration: IConfig;374readonly unresolvedConfiguration: IConfig | undefined;375readonly state: State;376readonly root: IWorkspaceFolder | undefined;377readonly parentSession: IDebugSession | undefined;378readonly subId: string | undefined;379readonly compact: boolean;380readonly compoundRoot: DebugCompoundRoot | undefined;381readonly saveBeforeRestart: boolean;382readonly name: string;383readonly autoExpandLazyVariables: boolean;384readonly suppressDebugToolbar: boolean;385readonly suppressDebugStatusbar: boolean;386readonly suppressDebugView: boolean;387readonly lifecycleManagedByParent: boolean;388/** Test run this debug session was spawned by */389readonly correlatedTestRun?: LiveTestResult;390391setSubId(subId: string | undefined): void;392393getMemory(memoryReference: string): IMemoryRegion;394395setName(name: string): void;396readonly onDidChangeName: Event<string>;397getLabel(): string;398399getSourceForUri(modelUri: uri): Source | undefined;400getSource(raw?: DebugProtocol.Source): Source;401402setConfiguration(configuration: { resolved: IConfig; unresolved: IConfig | undefined }): void;403rawUpdate(data: IRawModelUpdate): void;404405getThread(threadId: number): IThread | undefined;406getAllThreads(): IThread[];407clearThreads(removeThreads: boolean, reference?: number): void;408getStoppedDetails(): IRawStoppedDetails | undefined;409410getReplElements(): IReplElement[];411hasSeparateRepl(): boolean;412removeReplExpressions(): void;413addReplExpression(stackFrame: IStackFrame | undefined, name: string): Promise<void>;414appendToRepl(data: INewReplElementData): void;415/** Cancel any associated test run set through the DebugSessionOptions */416cancelCorrelatedTestRun(): void;417418// session events419readonly onDidEndAdapter: Event<AdapterEndEvent | undefined>;420readonly onDidChangeState: Event<void>;421readonly onDidChangeReplElements: Event<IReplElement | undefined>;422423/** DA capabilities. Set only when there is a running session available. */424readonly capabilities: DebugProtocol.Capabilities;425/** DA capabilities. These are retained on the session even after is implementation ends. */426readonly rememberedCapabilities?: DebugProtocol.Capabilities;427428// DAP events429430readonly onDidLoadedSource: Event<LoadedSourceEvent>;431readonly onDidCustomEvent: Event<DebugProtocol.Event>;432readonly onDidProgressStart: Event<DebugProtocol.ProgressStartEvent>;433readonly onDidProgressUpdate: Event<DebugProtocol.ProgressUpdateEvent>;434readonly onDidProgressEnd: Event<DebugProtocol.ProgressEndEvent>;435readonly onDidInvalidateMemory: Event<DebugProtocol.MemoryEvent>;436437// DAP request438439initialize(dbgr: IDebugger): Promise<void>;440launchOrAttach(config: IConfig): Promise<void>;441restart(): Promise<void>;442terminate(restart?: boolean /* false */): Promise<void>;443disconnect(restart?: boolean /* false */, suspend?: boolean): Promise<void>;444445sendBreakpoints(modelUri: uri, bpts: IBreakpoint[], sourceModified: boolean): Promise<void>;446sendFunctionBreakpoints(fbps: IFunctionBreakpoint[]): Promise<void>;447dataBreakpointInfo(name: string, variablesReference?: number): Promise<IDataBreakpointInfoResponse | undefined>;448dataBytesBreakpointInfo(address: string, bytes: number): Promise<IDataBreakpointInfoResponse | undefined>;449sendDataBreakpoints(dbps: IDataBreakpoint[]): Promise<void>;450sendInstructionBreakpoints(dbps: IInstructionBreakpoint[]): Promise<void>;451sendExceptionBreakpoints(exbpts: IExceptionBreakpoint[]): Promise<void>;452breakpointsLocations(uri: uri, lineNumber: number): Promise<IPosition[]>;453getDebugProtocolBreakpoint(breakpointId: string): DebugProtocol.Breakpoint | undefined;454resolveLocationReference(locationReference: number): Promise<IDebugLocationReferenced>;455456stackTrace(threadId: number, startFrame: number, levels: number, token: CancellationToken): Promise<DebugProtocol.StackTraceResponse | undefined>;457exceptionInfo(threadId: number): Promise<IExceptionInfo | undefined>;458scopes(frameId: number, threadId: number): Promise<DebugProtocol.ScopesResponse | undefined>;459variables(variablesReference: number, threadId: number | undefined, filter: 'indexed' | 'named' | undefined, start: number | undefined, count: number | undefined): Promise<DebugProtocol.VariablesResponse | undefined>;460evaluate(expression: string, frameId?: number, context?: string, location?: IDebugEvaluatePosition): Promise<DebugProtocol.EvaluateResponse | undefined>;461customRequest(request: string, args: any): Promise<DebugProtocol.Response | undefined>;462cancel(progressId: string): Promise<DebugProtocol.CancelResponse | undefined>;463disassemble(memoryReference: string, offset: number, instructionOffset: number, instructionCount: number): Promise<DebugProtocol.DisassembledInstruction[] | undefined>;464readMemory(memoryReference: string, offset: number, count: number): Promise<DebugProtocol.ReadMemoryResponse | undefined>;465writeMemory(memoryReference: string, offset: number, data: string, allowPartial?: boolean): Promise<DebugProtocol.WriteMemoryResponse | undefined>;466467restartFrame(frameId: number, threadId: number): Promise<void>;468next(threadId: number, granularity?: DebugProtocol.SteppingGranularity): Promise<void>;469stepIn(threadId: number, targetId?: number, granularity?: DebugProtocol.SteppingGranularity): Promise<void>;470stepInTargets(frameId: number): Promise<DebugProtocol.StepInTarget[] | undefined>;471stepOut(threadId: number, granularity?: DebugProtocol.SteppingGranularity): Promise<void>;472stepBack(threadId: number, granularity?: DebugProtocol.SteppingGranularity): Promise<void>;473continue(threadId: number): Promise<void>;474reverseContinue(threadId: number): Promise<void>;475pause(threadId: number): Promise<void>;476terminateThreads(threadIds: number[]): Promise<void>;477478completions(frameId: number | undefined, threadId: number, text: string, position: Position, token: CancellationToken): Promise<DebugProtocol.CompletionsResponse | undefined>;479setVariable(variablesReference: number | undefined, name: string, value: string): Promise<DebugProtocol.SetVariableResponse | undefined>;480setExpression(frameId: number, expression: string, value: string): Promise<DebugProtocol.SetExpressionResponse | undefined>;481loadSource(resource: uri): Promise<DebugProtocol.SourceResponse | undefined>;482getLoadedSources(): Promise<Source[]>;483484gotoTargets(source: DebugProtocol.Source, line: number, column?: number): Promise<DebugProtocol.GotoTargetsResponse | undefined>;485goto(threadId: number, targetId: number): Promise<DebugProtocol.GotoResponse | undefined>;486}487488export interface IThread extends ITreeElement {489490/**491* Process the thread belongs to492*/493readonly session: IDebugSession;494495/**496* Id of the thread generated by the debug adapter backend.497*/498readonly threadId: number;499500/**501* Name of the thread.502*/503readonly name: string;504505/**506* Information about the current thread stop event. Undefined if thread is not stopped.507*/508readonly stoppedDetails: IRawStoppedDetails | undefined;509510/**511* Information about the exception if an 'exception' stopped event raised and DA supports the 'exceptionInfo' request, otherwise undefined.512*/513readonly exceptionInfo: Promise<IExceptionInfo | undefined>;514515readonly stateLabel: string;516517/**518* Gets the callstack if it has already been received from the debug519* adapter.520*/521getCallStack(): ReadonlyArray<IStackFrame>;522523524/**525* Gets the top stack frame that is not hidden if the callstack has already been received from the debug adapter526*/527getTopStackFrame(): IStackFrame | undefined;528529/**530* Invalidates the callstack cache531*/532clearCallStack(): void;533534/**535* Indicates whether this thread is stopped. The callstack for stopped536* threads can be retrieved from the debug adapter.537*/538readonly stopped: boolean;539540next(granularity?: DebugProtocol.SteppingGranularity): Promise<any>;541stepIn(granularity?: DebugProtocol.SteppingGranularity): Promise<any>;542stepOut(granularity?: DebugProtocol.SteppingGranularity): Promise<any>;543stepBack(granularity?: DebugProtocol.SteppingGranularity): Promise<any>;544continue(): Promise<any>;545pause(): Promise<any>;546terminate(): Promise<any>;547reverseContinue(): Promise<any>;548}549550export interface IScope extends IExpressionContainer {551readonly name: string;552readonly expensive: boolean;553readonly range?: IRange;554readonly hasChildren: boolean;555}556557export interface IStackFrame extends ITreeElement {558readonly thread: IThread;559readonly name: string;560readonly presentationHint: string | undefined;561readonly frameId: number;562readonly range: IRange;563readonly source: Source;564readonly canRestart: boolean;565readonly instructionPointerReference?: string;566getScopes(): Promise<IScope[]>;567getMostSpecificScopes(range: IRange): Promise<ReadonlyArray<IScope>>;568forgetScopes(): void;569restart(): Promise<any>;570toString(): string;571openInEditor(editorService: IEditorService, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise<IEditorPane | undefined>;572equals(other: IStackFrame): boolean;573}574575export function isFrameDeemphasized(frame: IStackFrame): boolean {576const hint = frame.presentationHint ?? frame.source.presentationHint;577return hint === 'deemphasize' || hint === 'subtle';578}579580export interface IEnablement extends ITreeElement {581readonly enabled: boolean;582}583584export interface IBreakpointData {585readonly id?: string;586readonly lineNumber: number;587readonly column?: number;588readonly enabled?: boolean;589readonly condition?: string;590readonly logMessage?: string;591readonly hitCondition?: string;592readonly triggeredBy?: string;593readonly mode?: string;594readonly modeLabel?: string;595}596597export interface IBreakpointUpdateData {598readonly condition?: string;599readonly hitCondition?: string;600readonly logMessage?: string;601readonly lineNumber?: number;602readonly column?: number;603readonly triggeredBy?: string;604readonly mode?: string;605readonly modeLabel?: string;606}607608export interface IBaseBreakpoint extends IEnablement {609readonly condition?: string;610readonly hitCondition?: string;611readonly logMessage?: string;612readonly verified: boolean;613readonly supported: boolean;614readonly message?: string;615/** The preferred mode of the breakpoint from {@link DebugProtocol.BreakpointMode} */616readonly mode?: string;617/** The preferred mode label of the breakpoint from {@link DebugProtocol.BreakpointMode} */618readonly modeLabel?: string;619readonly sessionsThatVerified: string[];620getIdFromAdapter(sessionId: string): number | undefined;621}622623export interface IBreakpoint extends IBaseBreakpoint {624/** URI where the breakpoint was first set by the user. */625readonly originalUri: uri;626/** URI where the breakpoint is currently shown; may be moved by debugger */627readonly uri: uri;628readonly lineNumber: number;629readonly endLineNumber?: number;630readonly column?: number;631readonly endColumn?: number;632readonly adapterData: any;633readonly sessionAgnosticData: { lineNumber: number; column: number | undefined };634/** An ID of the breakpoint that triggers this breakpoint. */635readonly triggeredBy?: string;636/** Pending on the trigger breakpoint, which means this breakpoint is not yet sent to DA */637readonly pending: boolean;638639/** Marks that a session did trigger the breakpoint. */640setSessionDidTrigger(sessionId: string, didTrigger?: boolean): void;641/** Gets whether the `triggeredBy` condition has been met in the given sesison ID. */642getSessionDidTrigger(sessionId: string): boolean;643644toDAP(): DebugProtocol.SourceBreakpoint;645}646647export interface IFunctionBreakpoint extends IBaseBreakpoint {648readonly name: string;649toDAP(): DebugProtocol.FunctionBreakpoint;650}651652export interface IExceptionBreakpoint extends IBaseBreakpoint {653readonly filter: string;654readonly label: string;655readonly description: string | undefined;656}657658export const enum DataBreakpointSetType {659Variable,660Address,661}662663/**664* Source for a data breakpoint. A data breakpoint on a variable always has a665* `dataId` because it cannot reference that variable globally, but addresses666* can request info repeated and use session-specific data.667*/668export type DataBreakpointSource =669| { type: DataBreakpointSetType.Variable; dataId: string }670| { type: DataBreakpointSetType.Address; address: string; bytes: number };671672export interface IDataBreakpoint extends IBaseBreakpoint {673readonly description: string;674readonly canPersist: boolean;675readonly src: DataBreakpointSource;676readonly accessType: DebugProtocol.DataBreakpointAccessType;677toDAP(session: IDebugSession): Promise<DebugProtocol.DataBreakpoint | undefined>;678}679680export interface IInstructionBreakpoint extends IBaseBreakpoint {681readonly instructionReference: string;682readonly offset?: number;683/** Original instruction memory address; display purposes only */684readonly address: bigint;685toDAP(): DebugProtocol.InstructionBreakpoint;686}687688export interface IExceptionInfo {689readonly id?: string;690readonly description?: string;691readonly breakMode: string | null;692readonly details?: DebugProtocol.ExceptionDetails;693}694695// model interfaces696697export interface IViewModel extends ITreeElement {698/**699* Returns the focused debug session or undefined if no session is stopped.700*/701readonly focusedSession: IDebugSession | undefined;702703/**704* Returns the focused thread or undefined if no thread is stopped.705*/706readonly focusedThread: IThread | undefined;707708/**709* Returns the focused stack frame or undefined if there are no stack frames.710*/711readonly focusedStackFrame: IStackFrame | undefined;712713setVisualizedExpression(original: IExpression, visualized: IExpression & { treeId: string } | undefined): void;714/** Returns the visualized expression if loaded, or a tree it should be visualized with, or undefined */715getVisualizedExpression(expression: IExpression): IExpression | string | undefined;716getSelectedExpression(): { expression: IExpression; settingWatch: boolean } | undefined;717setSelectedExpression(expression: IExpression | undefined, settingWatch: boolean): void;718updateViews(): void;719720isMultiSessionView(): boolean;721722onDidFocusSession: Event<IDebugSession | undefined>;723onDidFocusThread: Event<{ thread: IThread | undefined; explicit: boolean; session: IDebugSession | undefined }>;724onDidFocusStackFrame: Event<{ stackFrame: IStackFrame | undefined; explicit: boolean; session: IDebugSession | undefined }>;725onDidSelectExpression: Event<{ expression: IExpression; settingWatch: boolean } | undefined>;726onDidEvaluateLazyExpression: Event<IExpressionContainer>;727/**728* Fired when `setVisualizedExpression`, to migrate elements currently729* rendered as `original` to the `replacement`.730*/731onDidChangeVisualization: Event<{ original: IExpression; replacement: IExpression }>;732onWillUpdateViews: Event<void>;733734evaluateLazyExpression(expression: IExpressionContainer): void;735}736737export interface IEvaluate {738evaluate(session: IDebugSession, stackFrame: IStackFrame, context: string): Promise<void>;739}740741export interface IDebugModel extends ITreeElement {742getSession(sessionId: string | undefined, includeInactive?: boolean): IDebugSession | undefined;743getSessions(includeInactive?: boolean): IDebugSession[];744getBreakpoints(filter?: { uri?: uri; originalUri?: uri; lineNumber?: number; column?: number; enabledOnly?: boolean; triggeredOnly?: boolean }): ReadonlyArray<IBreakpoint>;745areBreakpointsActivated(): boolean;746getFunctionBreakpoints(): ReadonlyArray<IFunctionBreakpoint>;747getDataBreakpoints(): ReadonlyArray<IDataBreakpoint>;748749/**750* Returns list of all exception breakpoints.751*/752getExceptionBreakpoints(): ReadonlyArray<IExceptionBreakpoint>;753754/**755* Returns list of exception breakpoints for the given session756* @param sessionId Session id. If falsy, returns the breakpoints from the last set fallback session.757*/758getExceptionBreakpointsForSession(sessionId?: string): ReadonlyArray<IExceptionBreakpoint>;759760getInstructionBreakpoints(): ReadonlyArray<IInstructionBreakpoint>;761getWatchExpressions(): ReadonlyArray<IExpression & IEvaluate>;762registerBreakpointModes(debugType: string, modes: DebugProtocol.BreakpointMode[]): void;763getBreakpointModes(forBreakpointType: 'source' | 'exception' | 'data' | 'instruction'): DebugProtocol.BreakpointMode[];764onDidChangeBreakpoints: Event<IBreakpointsChangeEvent | undefined>;765onDidChangeCallStack: Event<void>;766/**767* The expression has been added, removed, or repositioned.768*/769onDidChangeWatchExpressions: Event<IExpression | undefined>;770/**771* The expression's value has changed.772*/773onDidChangeWatchExpressionValue: Event<IExpression | undefined>;774775fetchCallstack(thread: IThread, levels?: number): Promise<void>;776}777778/**779* An event describing a change to the set of [breakpoints](#debug.Breakpoint).780*/781export interface IBreakpointsChangeEvent {782added?: Array<IBreakpoint | IFunctionBreakpoint | IDataBreakpoint | IInstructionBreakpoint>;783removed?: Array<IBreakpoint | IFunctionBreakpoint | IDataBreakpoint | IInstructionBreakpoint>;784changed?: Array<IBreakpoint | IFunctionBreakpoint | IDataBreakpoint | IInstructionBreakpoint>;785sessionOnly: boolean;786}787788// Debug configuration interfaces789790export interface IDebugConfiguration {791allowBreakpointsEverywhere: boolean;792gutterMiddleClickAction: 'logpoint' | 'conditionalBreakpoint' | 'triggeredBreakpoint' | 'none';793openDebug: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart' | 'openOnDebugBreak';794openExplorerOnEnd: boolean;795inlineValues: boolean | 'auto' | 'on' | 'off'; // boolean for back-compat796toolBarLocation: 'floating' | 'docked' | 'commandCenter' | 'hidden';797showInStatusBar: 'never' | 'always' | 'onFirstSessionStart';798internalConsoleOptions: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart';799extensionHostDebugAdapter: boolean;800enableAllHovers: boolean;801showSubSessionsInToolBar: boolean;802closeReadonlyTabsOnEnd: boolean;803console: {804fontSize: number;805fontFamily: string;806lineHeight: number;807wordWrap: boolean;808closeOnEnd: boolean;809collapseIdenticalLines: boolean;810historySuggestions: boolean;811acceptSuggestionOnEnter: 'off' | 'on';812maximumLines: number;813};814focusWindowOnBreak: boolean;815focusEditorOnBreak: boolean;816onTaskErrors: 'debugAnyway' | 'showErrors' | 'prompt' | 'abort';817showBreakpointsInOverviewRuler: boolean;818showInlineBreakpointCandidates: boolean;819confirmOnExit: 'always' | 'never';820disassemblyView: {821showSourceCode: boolean;822};823autoExpandLazyVariables: 'auto' | 'off' | 'on';824enableStatusBarColor: boolean;825showVariableTypes: boolean;826hideSlowPreLaunchWarning: boolean;827}828829export interface IGlobalConfig {830version: string;831compounds: ICompound[];832configurations: IConfig[];833}834835interface IEnvConfig {836internalConsoleOptions?: 'neverOpen' | 'openOnSessionStart' | 'openOnFirstSessionStart';837preRestartTask?: string | ITaskIdentifier;838postRestartTask?: string | ITaskIdentifier;839preLaunchTask?: string | ITaskIdentifier;840postDebugTask?: string | ITaskIdentifier;841debugServer?: number;842noDebug?: boolean;843suppressMultipleSessionWarning?: boolean;844}845846export interface IConfigPresentation {847hidden?: boolean;848group?: string;849order?: number;850}851852export interface IConfig extends IEnvConfig {853854// fundamental attributes855type: string;856request: string;857name: string;858presentation?: IConfigPresentation;859// platform specifics860windows?: IEnvConfig;861osx?: IEnvConfig;862linux?: IEnvConfig;863864// internals865__configurationTarget?: ConfigurationTarget;866__sessionId?: string;867__restart?: any;868__autoAttach?: boolean;869port?: number; // TODO870}871872export interface ICompound {873name: string;874stopAll?: boolean;875preLaunchTask?: string | ITaskIdentifier;876configurations: (string | { name: string; folder: string })[];877presentation?: IConfigPresentation;878}879880export interface IDebugAdapter extends IDisposable {881readonly onError: Event<Error>;882readonly onExit: Event<number | null>;883onRequest(callback: (request: DebugProtocol.Request) => void): void;884onEvent(callback: (event: DebugProtocol.Event) => void): void;885startSession(): Promise<void>;886sendMessage(message: DebugProtocol.ProtocolMessage): void;887sendResponse(response: DebugProtocol.Response): void;888sendRequest(command: string, args: any, clb: (result: DebugProtocol.Response) => void, timeout?: number): number;889stopSession(): Promise<void>;890}891892export interface IDebugAdapterFactory extends ITerminalLauncher {893createDebugAdapter(session: IDebugSession): IDebugAdapter;894substituteVariables(folder: IWorkspaceFolder | undefined, config: IConfig): Promise<IConfig>;895}896897export interface IDebugAdapterExecutableOptions {898cwd?: string;899env?: { [key: string]: string };900}901902export interface IDebugAdapterExecutable {903readonly type: 'executable';904readonly command: string;905readonly args: string[];906readonly options?: IDebugAdapterExecutableOptions;907}908909export interface IDebugAdapterServer {910readonly type: 'server';911readonly port: number;912readonly host?: string;913}914915export interface IDebugAdapterNamedPipeServer {916readonly type: 'pipeServer';917readonly path: string;918}919920export interface IDebugAdapterInlineImpl extends IDisposable {921readonly onDidSendMessage: Event<DebugProtocol.Message>;922handleMessage(message: DebugProtocol.Message): void;923}924925export interface IDebugAdapterImpl {926readonly type: 'implementation';927}928929export type IAdapterDescriptor = IDebugAdapterExecutable | IDebugAdapterServer | IDebugAdapterNamedPipeServer | IDebugAdapterImpl;930931export interface IPlatformSpecificAdapterContribution {932program?: string;933args?: string[];934runtime?: string;935runtimeArgs?: string[];936}937938export interface IDebuggerContribution extends IPlatformSpecificAdapterContribution {939type: string;940label?: string;941win?: IPlatformSpecificAdapterContribution;942winx86?: IPlatformSpecificAdapterContribution;943windows?: IPlatformSpecificAdapterContribution;944osx?: IPlatformSpecificAdapterContribution;945linux?: IPlatformSpecificAdapterContribution;946947// internal948aiKey?: string;949950// supported languages951languages?: string[];952953// debug configuration support954configurationAttributes?: any;955initialConfigurations?: any[];956configurationSnippets?: IJSONSchemaSnippet[];957variables?: { [key: string]: string };958when?: string;959hiddenWhen?: string;960deprecated?: string;961strings?: { [key in DebuggerString]: string };962}963964export interface IBreakpointContribution {965language: string;966when?: string;967}968969export enum DebugConfigurationProviderTriggerKind {970/**971* `DebugConfigurationProvider.provideDebugConfigurations` is called to provide the initial debug configurations for a newly created launch.json.972*/973Initial = 1,974/**975* `DebugConfigurationProvider.provideDebugConfigurations` is called to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).976*/977Dynamic = 2978}979980export interface IDebugConfigurationProvider {981readonly type: string;982readonly triggerKind: DebugConfigurationProviderTriggerKind;983resolveDebugConfiguration?(folderUri: uri | undefined, debugConfiguration: IConfig, token: CancellationToken): Promise<IConfig | null | undefined>;984resolveDebugConfigurationWithSubstitutedVariables?(folderUri: uri | undefined, debugConfiguration: IConfig, token: CancellationToken): Promise<IConfig | null | undefined>;985provideDebugConfigurations?(folderUri: uri | undefined, token: CancellationToken): Promise<IConfig[]>;986}987988export interface IDebugAdapterDescriptorFactory {989readonly type: string;990createDebugAdapterDescriptor(session: IDebugSession): Promise<IAdapterDescriptor>;991}992993interface ITerminalLauncher {994runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, sessionId: string): Promise<number | undefined>;995}996997export interface IConfigurationManager {998999/**1000* Returns an object containing the selected launch configuration and the selected configuration name. Both these fields can be null (no folder workspace).1001*/1002readonly selectedConfiguration: {1003launch: ILaunch | undefined;1004// Potentially activates extensions1005getConfig: () => Promise<IConfig | undefined>;1006name: string | undefined;1007// Type is used when matching dynamic configurations to their corresponding provider1008type: string | undefined;1009};10101011selectConfiguration(launch: ILaunch | undefined, name?: string, config?: IConfig, dynamicConfigOptions?: { type?: string }): Promise<void>;10121013getLaunches(): ReadonlyArray<ILaunch>;1014getLaunch(workspaceUri: uri | undefined): ILaunch | undefined;1015getAllConfigurations(): { launch: ILaunch; name: string; presentation?: IConfigPresentation }[];1016removeRecentDynamicConfigurations(name: string, type: string): void;1017getRecentDynamicConfigurations(): { name: string; type: string }[];10181019/**1020* Allows to register on change of selected debug configuration.1021*/1022onDidSelectConfiguration: Event<void>;10231024/**1025* Allows to register on change of selected debug configuration.1026*/1027onDidChangeConfigurationProviders: Event<void>;10281029hasDebugConfigurationProvider(debugType: string, triggerKind?: DebugConfigurationProviderTriggerKind): boolean;1030getDynamicProviders(): Promise<{ label: string; type: string; pick: () => Promise<{ launch: ILaunch; config: IConfig; label: string } | undefined> }[]>;1031getDynamicConfigurationsByType(type: string, token?: CancellationToken): Promise<{ launch: ILaunch; config: IConfig; label: string }[]>;10321033registerDebugConfigurationProvider(debugConfigurationProvider: IDebugConfigurationProvider): IDisposable;1034unregisterDebugConfigurationProvider(debugConfigurationProvider: IDebugConfigurationProvider): void;10351036resolveConfigurationByProviders(folderUri: uri | undefined, type: string | undefined, debugConfiguration: any, token: CancellationToken): Promise<any>;1037}10381039export enum DebuggerString {1040UnverifiedBreakpoints = 'unverifiedBreakpoints'1041}10421043export interface IAdapterManager {10441045onDidRegisterDebugger: Event<void>;10461047hasEnabledDebuggers(): boolean;1048getDebugAdapterDescriptor(session: IDebugSession): Promise<IAdapterDescriptor | undefined>;1049getDebuggerLabel(type: string): string | undefined;1050someDebuggerInterestedInLanguage(language: string): boolean;1051getDebugger(type: string): IDebuggerMetadata | undefined;10521053activateDebuggers(activationEvent: string, debugType?: string): Promise<void>;1054registerDebugAdapterFactory(debugTypes: string[], debugAdapterFactory: IDebugAdapterFactory): IDisposable;1055createDebugAdapter(session: IDebugSession): IDebugAdapter | undefined;1056registerDebugAdapterDescriptorFactory(debugAdapterDescriptorFactory: IDebugAdapterDescriptorFactory): IDisposable;1057unregisterDebugAdapterDescriptorFactory(debugAdapterDescriptorFactory: IDebugAdapterDescriptorFactory): void;10581059substituteVariables(debugType: string, folder: IWorkspaceFolder | undefined, config: IConfig): Promise<IConfig>;1060runInTerminal(debugType: string, args: DebugProtocol.RunInTerminalRequestArguments, sessionId: string): Promise<number | undefined>;1061getEnabledDebugger(type: string): (IDebugger & IDebuggerMetadata) | undefined;1062guessDebugger(gettingConfigurations: boolean): Promise<IGuessedDebugger | undefined>;10631064get onDidDebuggersExtPointRead(): Event<void>;1065}10661067export interface IGuessedDebugger {1068debugger: IDebugger;1069withConfig?: {1070label: string;1071launch: ILaunch;1072config: IConfig;1073};1074}10751076export interface ILaunch {10771078/**1079* Resource pointing to the launch.json this object is wrapping.1080*/1081readonly uri: uri;10821083/**1084* Name of the launch.1085*/1086readonly name: string;10871088/**1089* Workspace of the launch. Can be undefined.1090*/1091readonly workspace: IWorkspaceFolder | undefined;10921093/**1094* Should this launch be shown in the debug dropdown.1095*/1096readonly hidden: boolean;10971098/**1099* Returns a configuration with the specified name.1100* Returns undefined if there is no configuration with the specified name.1101*/1102getConfiguration(name: string): IConfig | undefined;11031104/**1105* Returns a compound with the specified name.1106* Returns undefined if there is no compound with the specified name.1107*/1108getCompound(name: string): ICompound | undefined;11091110/**1111* Returns the names of all configurations and compounds.1112* Ignores configurations which are invalid.1113*/1114getConfigurationNames(ignoreCompoundsAndPresentation?: boolean): string[];11151116/**1117* Opens the launch.json file. Creates if it does not exist.1118*/1119openConfigFile(options: { preserveFocus: boolean; type?: string; suppressInitialConfigs?: boolean }, token?: CancellationToken): Promise<{ editor: IEditorPane | null; created: boolean }>;1120}11211122// Debug service interfaces11231124export const IDebugService = createDecorator<IDebugService>('debugService');11251126export interface IDebugService {1127readonly _serviceBrand: undefined;11281129/**1130* Gets the current debug state.1131*/1132readonly state: State;11331134readonly initializingOptions?: IDebugSessionOptions | undefined;11351136/**1137* Allows to register on debug state changes.1138*/1139onDidChangeState: Event<State>;11401141/**1142* Allows to register on sessions about to be created (not yet fully initialised).1143* This is fired exactly one time for any given session.1144*/1145onWillNewSession: Event<IDebugSession>;11461147/**1148* Fired when a new debug session is started. This may fire multiple times1149* for a single session due to restarts.1150*/1151onDidNewSession: Event<IDebugSession>;11521153/**1154* Allows to register on end session events.1155*1156* Contains a boolean indicating whether the session will restart. If restart1157* is true, the session should not considered to be dead yet.1158*/1159onDidEndSession: Event<{ session: IDebugSession; restart: boolean }>;11601161/**1162* Gets the configuration manager.1163*/1164getConfigurationManager(): IConfigurationManager;11651166/**1167* Gets the adapter manager.1168*/1169getAdapterManager(): IAdapterManager;11701171/**1172* Sets the focused stack frame and evaluates all expressions against the newly focused stack frame,1173*/1174focusStackFrame(focusedStackFrame: IStackFrame | undefined, thread?: IThread, session?: IDebugSession, options?: { explicit?: boolean; preserveFocus?: boolean; sideBySide?: boolean; pinned?: boolean }): Promise<void>;11751176/**1177* Returns true if breakpoints can be set for a given editor model. Depends on mode.1178*/1179canSetBreakpointsIn(model: EditorIModel): boolean;11801181/**1182* Adds new breakpoints to the model for the file specified with the uri. Notifies debug adapter of breakpoint changes.1183*/1184addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[], ariaAnnounce?: boolean): Promise<IBreakpoint[]>;11851186/**1187* Updates the breakpoints.1188*/1189updateBreakpoints(originalUri: uri, data: Map<string, IBreakpointUpdateData>, sendOnResourceSaved: boolean): Promise<void>;11901191/**1192* Enables or disables all breakpoints. If breakpoint is passed only enables or disables the passed breakpoint.1193* Notifies debug adapter of breakpoint changes.1194*/1195enableOrDisableBreakpoints(enable: boolean, breakpoint?: IEnablement): Promise<void>;11961197/**1198* Sets the global activated property for all breakpoints.1199* Notifies debug adapter of breakpoint changes.1200*/1201setBreakpointsActivated(activated: boolean): Promise<void>;12021203/**1204* Removes all breakpoints. If id is passed only removes the breakpoint associated with that id.1205* Notifies debug adapter of breakpoint changes.1206*/1207removeBreakpoints(id?: string): Promise<any>;12081209/**1210* Adds a new function breakpoint for the given name.1211*/1212addFunctionBreakpoint(opts?: IFunctionBreakpointOptions, id?: string): void;12131214/**1215* Updates an already existing function breakpoint.1216* Notifies debug adapter of breakpoint changes.1217*/1218updateFunctionBreakpoint(id: string, update: { name?: string; hitCondition?: string; condition?: string }): Promise<void>;12191220/**1221* Removes all function breakpoints. If id is passed only removes the function breakpoint with the passed id.1222* Notifies debug adapter of breakpoint changes.1223*/1224removeFunctionBreakpoints(id?: string): Promise<void>;12251226/**1227* Adds a new data breakpoint.1228*/1229addDataBreakpoint(opts: IDataBreakpointOptions): Promise<void>;12301231/**1232* Updates an already existing data breakpoint.1233* Notifies debug adapter of breakpoint changes.1234*/1235updateDataBreakpoint(id: string, update: { hitCondition?: string; condition?: string }): Promise<void>;12361237/**1238* Removes all data breakpoints. If id is passed only removes the data breakpoint with the passed id.1239* Notifies debug adapter of breakpoint changes.1240*/1241removeDataBreakpoints(id?: string): Promise<void>;12421243/**1244* Adds a new instruction breakpoint.1245*/1246addInstructionBreakpoint(opts: IInstructionBreakpointOptions): Promise<void>;12471248/**1249* Removes all instruction breakpoints. If address is passed only removes the instruction breakpoint with the passed address.1250* The address should be the address string supplied by the debugger from the "Disassemble" request.1251* Notifies debug adapter of breakpoint changes.1252*/1253removeInstructionBreakpoints(instructionReference?: string, offset?: number): Promise<void>;12541255setExceptionBreakpointCondition(breakpoint: IExceptionBreakpoint, condition: string | undefined): Promise<void>;12561257/**1258* Creates breakpoints based on the sesison filter options. This will create1259* disabled breakpoints (or enabled, if the filter indicates it's a default)1260* for each filter provided in the session.1261*/1262setExceptionBreakpointsForSession(session: IDebugSession, filters: DebugProtocol.ExceptionBreakpointsFilter[]): void;12631264/**1265* Sends all breakpoints to the passed session.1266* If session is not passed, sends all breakpoints to each session.1267*/1268sendAllBreakpoints(session?: IDebugSession): Promise<any>;12691270/**1271* Sends breakpoints of the given source to the passed session.1272*/1273sendBreakpoints(modelUri: uri, sourceModified?: boolean, session?: IDebugSession): Promise<any>;12741275/**1276* Adds a new watch expression and evaluates it against the debug adapter.1277*/1278addWatchExpression(name?: string): void;12791280/**1281* Renames a watch expression and evaluates it against the debug adapter.1282*/1283renameWatchExpression(id: string, newName: string): void;12841285/**1286* Moves a watch expression to a new possition. Used for reordering watch expressions.1287*/1288moveWatchExpression(id: string, position: number): void;12891290/**1291* Removes all watch expressions. If id is passed only removes the watch expression with the passed id.1292*/1293removeWatchExpressions(id?: string): void;12941295/**1296* Starts debugging. If the configOrName is not passed uses the selected configuration in the debug dropdown.1297* Also saves all files, manages if compounds are present in the configuration1298* and resolveds configurations via DebugConfigurationProviders.1299*1300* Returns true if the start debugging was successful. For compound launches, all configurations have to start successfully for it to return success.1301* On errors the startDebugging will throw an error, however some error and cancelations are handled and in that case will simply return false.1302*/1303startDebugging(launch: ILaunch | undefined, configOrName?: IConfig | string, options?: IDebugSessionOptions, saveBeforeStart?: boolean): Promise<boolean>;13041305/**1306* Restarts a session or creates a new one if there is no active session.1307*/1308restartSession(session: IDebugSession, restartData?: any): Promise<any>;13091310/**1311* Stops the session. If no session is specified then all sessions are stopped.1312*/1313stopSession(session: IDebugSession | undefined, disconnect?: boolean, suspend?: boolean): Promise<any>;13141315/**1316* Makes unavailable all sources with the passed uri. Source will appear as grayed out in callstack view.1317*/1318sourceIsNotAvailable(uri: uri): void;13191320/**1321* Gets the current debug model.1322*/1323getModel(): IDebugModel;13241325/**1326* Gets the current view model.1327*/1328getViewModel(): IViewModel;13291330/**1331* Resumes execution and pauses until the given position is reached.1332*/1333runTo(uri: uri, lineNumber: number, column?: number): Promise<void>;1334}13351336// Editor interfaces1337export const enum BreakpointWidgetContext {1338CONDITION = 0,1339HIT_COUNT = 1,1340LOG_MESSAGE = 2,1341TRIGGER_POINT = 31342}13431344export interface IDebugEditorContribution extends editorCommon.IEditorContribution {1345showHover(range: Position, focus: boolean): Promise<void>;1346addLaunchConfiguration(): Promise<any>;1347closeExceptionWidget(): void;1348}13491350export interface IBreakpointEditorContribution extends editorCommon.IEditorContribution {1351showBreakpointWidget(lineNumber: number, column: number | undefined, context?: BreakpointWidgetContext): void;1352closeBreakpointWidget(): void;1353getContextMenuActionsAtPosition(lineNumber: number, model: EditorIModel): IAction[];1354}13551356export interface IReplConfiguration {1357readonly fontSize: number;1358readonly fontFamily: string;1359readonly lineHeight: number;1360readonly cssLineHeight: string;1361readonly backgroundColor: Color | undefined;1362readonly fontSizeForTwistie: number;1363}13641365export interface IReplOptions {1366readonly replConfiguration: IReplConfiguration;1367}13681369export interface IDebugVisualizationContext {1370variable: DebugProtocol.Variable;1371containerId?: number;1372frameId?: number;1373threadId: number;1374sessionId: string;1375}13761377export const enum DebugVisualizationType {1378Command,1379Tree,1380}13811382export type MainThreadDebugVisualization =1383| { type: DebugVisualizationType.Command }1384| { type: DebugVisualizationType.Tree; id: string };138513861387export const enum DebugTreeItemCollapsibleState {1388None = 0,1389Collapsed = 1,1390Expanded = 21391}13921393export interface IDebugVisualizationTreeItem {1394id: number;1395label: string;1396description?: string;1397collapsibleState: DebugTreeItemCollapsibleState;1398contextValue?: string;1399canEdit?: boolean;1400}14011402export namespace IDebugVisualizationTreeItem {1403export type Serialized = IDebugVisualizationTreeItem;1404export const deserialize = (v: Serialized): IDebugVisualizationTreeItem => v;1405export const serialize = (item: IDebugVisualizationTreeItem): Serialized => item;1406}14071408export interface IDebugVisualization {1409id: number;1410name: string;1411iconPath: { light?: URI; dark: URI } | undefined;1412iconClass: string | undefined;1413visualization: MainThreadDebugVisualization | undefined;1414}14151416export namespace IDebugVisualization {1417export interface Serialized {1418id: number;1419name: string;1420iconPath?: { light?: UriComponents; dark: UriComponents };1421iconClass?: string;1422visualization?: MainThreadDebugVisualization;1423}14241425export const deserialize = (v: Serialized): IDebugVisualization => ({1426id: v.id,1427name: v.name,1428iconPath: v.iconPath && { light: URI.revive(v.iconPath.light), dark: URI.revive(v.iconPath.dark) },1429iconClass: v.iconClass,1430visualization: v.visualization,1431});14321433export const serialize = (visualizer: IDebugVisualization): Serialized => visualizer;1434}143514361437