debugModel.ts ×185

Frontier kind: Code frontier

unlabeled · c_860e608c6e23

9 tests · 23428 LOC · 114 files · introduces 0 tests · 988 LOC · 5 files

Introduces — evidence that enters the hierarchy at this concept

Code
311 ranges988 lines · 5 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2663 ranges23428 lines · 114 files · Browse complete extent
All tests (intent)
9 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

5 files ranked by introduced lines: 988 introduced LOC across 311 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/debug/common/debugModel.ts 635 introduced LOC · 185 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- debugModel.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { distinct } from '../../../../base/common/arrays.js';
7 > import { DeferredPromise, RunOnceScheduler } from '../../../../base/common/async.js';
8 > import { VSBuffer, decodeBase64, encodeBase64 } from '../../../../base/common/buffer.js';
9 > import { CancellationTokenSource } from '../../../../base/common/cancellation.js';
10 > import { Emitter, Event, trackSetChanges } from '../../../../base/common/event.js';
11 > import { stringHash } from '../../../../base/common/hash.js';
12 > import { Disposable } from '../../../../base/common/lifecycle.js';
13 > import { mixin } from '../../../../base/common/objects.js';
14 > import { autorun } from '../../../../base/common/observable.js';
15 > import * as resources from '../../../../base/common/resources.js';
16 > import { isString, isUndefinedOrNull } from '../../../../base/common/types.js';
17 > import { URI, URI as uri } from '../../../../base/common/uri.js';
18 > import { generateUuid } from '../../../../base/common/uuid.js';
19 > import { IRange, Range } from '../../../../editor/common/core/range.js';
20 > import * as nls from '../../../../nls.js';
21 > import { ILogService } from '../../../../platform/log/common/log.js';
22 > import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
23 > import { IEditorPane } from '../../../common/editor.js';
24 > import { DEBUG_MEMORY_SCHEME, DataBreakpointSetType, DataBreakpointSource, DebugTreeItemCollapsibleState, IBaseBreakpoint, IBreakpoint, IBreakpointData, IBreakpointUpdateData, IBreakpointsChangeEvent, IDataBreakpoint, IDebugEvaluatePosition, IDebugModel, IDebugSession, IDebugVisualizationTreeItem, IEnablement, IExceptionBreakpoint, IExceptionInfo, IExpression, IExpressionContainer, IFunctionBreakpoint, IInstructionBreakpoint, IMemoryInvalidationEvent, IMemoryRegion, IRawModelUpdate, IRawStoppedDetails, IScope, IStackFrame, IThread, ITreeElement, MemoryRange, MemoryRangeType, State, isFrameDeemphasized } from './debug.js';
25 > import { Source, UNKNOWN_SOURCE_LABEL, getUriFromSource } from './debugSource.js';
26 > import { DebugStorage } from './debugStorage.js';
27 > import { IDebugVisualizerService } from './debugVisualizers.js';
28 > import { DisassemblyViewInput } from './disassemblyViewInput.js';
29 > import { IEditorService } from '../../../services/editor/common/editorService.js';
30 > import { ITextFileService } from '../../../services/textfile/common/textfiles.js';
31 >
32 > interface IDebugProtocolVariableWithContext extends DebugProtocol.Variable {
33 > __vscodeVariableMenuContext?: string;
34 > }
35 >
36 > export class ExpressionContainer implements IExpressionContainer {
37 >
38 > public static readonly allValues = new Map<string, string>();
39 > // Use chunks to support variable paging #9537
40 > private static readonly BASE_CHUNK_SIZE = 100;
41 >
42 > public type: string | undefined;
43 > public valueChanged = false;
44 > private _value: string = '';
45 > protected children?: Promise<IExpression[]>;
46 >
47 > constructor(
48 protected session: IDebugSession | undefined,
49 protected readonly threadId: number | undefined,
57 public valueLocationReference: number | undefined = undefined,
58 ) { }
60 > get reference(): number | undefined {
61 return this._reference;
62 }
64 > set reference(value: number | undefined) {
65 this._reference = value;
66 this.children = undefined; // invalidate children cache
67 }
69 > async evaluateLazy(): Promise<void> {
70 if (typeof this.reference === 'undefined') {
71 return;
88 this.adoptLazyResponse(dummyVar);
89 }
91 > protected adoptLazyResponse(response: DebugProtocol.Variable): void {
92 }
94 > getChildren(): Promise<IExpression[]> {
95 if (!this.children) {
96 this.children = this.doGetChildren();
99 return this.children;
100 }
102 > private async doGetChildren(): Promise<IExpression[]> {
103 if (!this.hasChildren) {
104 return [];
133 return children.concat(variables);
134 }
136 > getId(): string {
137 return this.id;
138 }
140 > getSession(): IDebugSession | undefined {
141 return this.session;
142 }
144 > get value(): string {
145 return this._value;
146 }
148 > get hasChildren(): boolean {
149 // only variables with reference > 0 have children.
150 return !!this.reference && this.reference > 0 && !this.presentationHint?.lazy;
151 }
153 > private async fetchVariables(start: number | undefined, count: number | undefined, filter: 'indexed' | 'named' | undefined): Promise<Variable[]> {
154 try {
155 const response = await this.session!.variables(this.reference || 0, this.threadId, filter, start, count);
178 }
179 }
181 > // The adapter explicitly sents the children count of an expression only if there are lots of children which should be chunked.
182 > private get getChildrenInChunks(): boolean {
183 return !!this.indexedVariables;
184 }
186 > set value(value: string) {
187 this._value = value;
188 this.valueChanged = !!ExpressionContainer.allValues.get(this.getId()) &&
190 ExpressionContainer.allValues.set(this.getId(), value);
191 }
193 > toString(): string {
194 return this.value;
195 }
197 > async evaluateExpression(
198 expression: string,
199 session: IDebugSession | undefined,
238 }
239 }
240 > } debugModel.ts
241 >
242 function handleSetResponse(expression: ExpressionContainer, response: DebugProtocol.SetVariableResponse | DebugProtocol.SetExpressionResponse | undefined): void {
243 if (response && response.body) {
251 }
252 }
254 > export class VisualizedExpression implements IExpression {
255 > public errorMessage?: string;
256 > private readonly id = generateUuid();
257 >
258 > evaluateLazy(): Promise<void> {
259 > return Promise.resolve();
260 > }
261 > getChildren(): Promise<IExpression[]> {
262 return this.visualizer.getVisualizedChildren(this.session, this.treeId, this.treeItem.id);
263 }
265 > getId(): string {
266 return this.id;
267 }
269 > get name() {
270 return this.treeItem.label;
271 }
273 > get value() {
274 return this.treeItem.description || '';
275 }
277 > get hasChildren() {
278 return this.treeItem.collapsibleState !== DebugTreeItemCollapsibleState.None;
279 }
281 > constructor(
282 private readonly session: IDebugSession | undefined,
283 private readonly visualizer: IDebugVisualizerService,
286 public readonly original?: Variable,
287 ) { }
289 > public getSession(): IDebugSession | undefined {
290 return this.session;
291 }
293 > /** Edits the value, sets the {@link errorMessage} and returns false if unsuccessful */
294 > public async edit(newValue: string) {
295 try {
296 await this.visualizer.editTreeItem(this.treeId, this.treeItem, newValue);
301 }
302 }
303 > } debugModel.ts
304 >
305 > export class Expression extends ExpressionContainer implements IExpression {
306 > static readonly DEFAULT_VALUE = nls.localize('notAvailable', "not available");
307 >
308 > public available: boolean;
309 >
310 > private readonly _onDidChangeValue = new Emitter<IExpression>();
311 > public readonly onDidChangeValue: Event<IExpression> = this._onDidChangeValue.event;
312 >
313 > constructor(public name: string, id = generateUuid()) {
314 super(undefined, undefined, 0, id);
315 this.available = false;
320 }
321 }
323 > async evaluate(session: IDebugSession | undefined, stackFrame: IStackFrame | undefined, context: string, keepLazyVars?: boolean, location?: IDebugEvaluatePosition): Promise<void> {
324 const hadDefaultValue = this.value === Expression.DEFAULT_VALUE;
325 this.available = await this.evaluateExpression(this.name, session, stackFrame, context, keepLazyVars, location);
328 }
329 }
331 > override toString(): string {
332 return `${this.name}\n${this.value}`;
333 }
335 > toJSON() {
336 return {
337 sessionId: this.getSession()?.getId(),
339 };
340 }
342 > toDebugProtocolObject(): DebugProtocol.Variable {
343 return {
344 name: this.name,
350 };
351 }
353 > async setExpression(value: string, stackFrame: IStackFrame): Promise<void> {
354 if (!this.session) {
355 return;
359 handleSetResponse(this, response);
360 }
361 > } debugModel.ts
362 >
363 > export class Variable extends ExpressionContainer implements IExpression {
364 >
365 > // Used to show the error message coming from the adapter when setting the value #7807
366 > public errorMessage: string | undefined;
367 >
368 > constructor(
369 session: IDebugSession | undefined,
370 threadId: number | undefined,
390 this.type = type;
391 }
393 > getThreadId() {
394 return this.threadId;
395 }
397 > async setVariable(value: string, stackFrame: IStackFrame): Promise<void> {
398 if (!this.session) {
399 return;
412 }
413 }
415 > async setExpression(value: string, stackFrame: IStackFrame): Promise<void> {
416 if (!this.session || !this.evaluateName) {
417 return;
421 handleSetResponse(this, response);
422 }
424 > override toString(): string {
425 return this.name ? `${this.name}: ${this.value}` : this.value;
426 }
428 > toJSON() {
429 return {
430 sessionId: this.getSession()?.getId(),
435 };
436 }
438 > protected override adoptLazyResponse(response: DebugProtocol.Variable): void {
439 this.evaluateName = response.evaluateName;
440 }
442 > toDebugProtocolObject(): DebugProtocol.Variable {
443 return {
444 name: this.name,
450 };
451 }
452 > } debugModel.ts
453 >
454 > export class Scope extends ExpressionContainer implements IScope {
455 >
456 > constructor(
457 public readonly stackFrame: IStackFrame,
458 id: number,
466 super(stackFrame.thread.session, stackFrame.thread.threadId, reference, `scope:${name}:${id}`, namedVariables, indexedVariables);
467 }
469 > get childrenHaveBeenLoaded(): boolean {
470 return !!this.children;
471 }
473 > override toString(): string {
474 return this.name;
475 }
477 > toDebugProtocolObject(): DebugProtocol.Scope {
478 return {
479 name: this.name,
482 };
483 }
484 > } debugModel.ts
485 >
486 > export class ErrorScope extends Scope {
487 >
488 > constructor(
489 stackFrame: IStackFrame,
490 index: number,
493 super(stackFrame, index, message, 0, false);
494 }
496 > override toString(): string {
497 return this.name;
498 }
499 > } debugModel.ts
500 >
501 > export class StackFrame implements IStackFrame {
502 >
503 > private scopes: Promise<Scope[]> | undefined;
504 >
505 > constructor(
506 public readonly thread: Thread,
507 public readonly frameId: number,
514 public readonly instructionPointerReference?: string
515 ) { }
517 > getId(): string {
518 return `stackframe:${this.thread.getId()}:${this.index}:${this.source.name}`;
519 }
521 > getScopes(): Promise<IScope[]> {
522 if (!this.scopes) {
523 this.scopes = this.thread.session.scopes(this.frameId, this.thread.threadId).then(response => {
545 return this.scopes;
546 }
548 > async getMostSpecificScopes(range: IRange): Promise<IScope[]> {
549 const scopes = await this.getScopes();
550 const nonExpensiveScopes = scopes.filter(s => !s.expensive);
558 return scopesContainingRange.length ? scopesContainingRange : nonExpensiveScopes;
559 }
561 > restart(): Promise<void> {
562 return this.thread.session.restartFrame(this.frameId, this.thread.threadId);
563 }
565 > forgetScopes(): void {
566 this.scopes = undefined;
567 }
569 > toString(): string {
570 const lineNumberToString = typeof this.range.startLineNumber === 'number' ? `:${this.range.startLineNumber}` : '';
571 const sourceToString = `${this.source.inMemory ? this.source.name : this.source.uri.fsPath}${lineNumberToString}`;
573 return sourceToString === UNKNOWN_SOURCE_LABEL ? this.name : `${this.name} (${sourceToString})`;
574 }
576 > async openInEditor(editorService: IEditorService, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise<IEditorPane | undefined> {
577 const threadStopReason = this.thread.stoppedDetails?.reason;
578 if (this.instructionPointerReference &&
588 return undefined;
589 }
591 > equals(other: IStackFrame): boolean {
592 return (this.name === other.name) && (other.thread === this.thread) && (this.frameId === other.frameId) && (other.source === this.source) && (Range.equalsRange(this.range, other.range));
593 }
594 > } debugModel.ts
595 >
596 > const KEEP_SUBTLE_FRAME_AT_TOP_REASONS: readonly string[] = ['breakpoint', 'step', 'function breakpoint'];
597 >
598 > export class Thread implements IThread {
599 > private callStack: IStackFrame[];
600 > private staleCallStack: IStackFrame[];
601 > private callStackCancellationTokens: CancellationTokenSource[] = [];
602 > public stoppedDetails: IRawStoppedDetails | undefined;
603 > public stopped: boolean;
604 > public reachedEndOfCallStack = false;
605 > public lastSteppingGranularity: DebugProtocol.SteppingGranularity | undefined;
606 >
607 > constructor(public readonly session: IDebugSession, public name: string, public readonly threadId: number) {
608 this.callStack = [];
609 this.staleCallStack = [];
610 this.stopped = false;
611 }
613 > getId(): string {
614 return `thread:${this.session.getId()}:${this.threadId}`;
615 }
617 > clearCallStack(): void {
618 if (this.callStack.length) {
619 this.staleCallStack = this.callStack;
623 this.callStackCancellationTokens = [];
624 }
626 > getCallStack(): IStackFrame[] {
627 return this.callStack;
628 }
630 > getStaleCallStack(): ReadonlyArray<IStackFrame> {
631 return this.staleCallStack;
632 }
634 > getTopStackFrame(): IStackFrame | undefined {
635 const callStack = this.getCallStack();
636 const stopReason = this.stoppedDetails?.reason;
641 return firstAvailableStackFrame;
642 }
644 > get stateLabel(): string {
645 if (this.stoppedDetails) {
646 return this.stoppedDetails.description ||
650 return nls.localize({ key: 'running', comment: ['indicates state'] }, "Running");
651 }
653 > /**
654 > * Queries the debug adapter for the callstack and returns a promise
655 > * which completes once the call stack has been retrieved.
656 > * If the thread is not stopped, it returns a promise to an empty array.
657 > * Only fetches the first stack frame for performance reasons. Calling this method consecutive times
658 > * gets the remainder of the call stack.
659 > */
660 > async fetchCallStack(levels = 20): Promise<void> {
661 if (this.stopped) {
662 const start = this.callStack.length;
673 }
674 }
676 > private async getCallStackImpl(startFrame: number, levels: number): Promise<IStackFrame[]> {
677 try {
678 const tokenSource = new CancellationTokenSource();
705 }
706 }
708 > /**
709 > * Returns exception info promise if the exception was thrown, otherwise undefined
710 > */
711 > get exceptionInfo(): Promise<IExceptionInfo | undefined> {
712 if (this.stoppedDetails && this.stoppedDetails.reason === 'exception') {
713 if (this.session.capabilities.supportsExceptionInfoRequest) {
721 return Promise.resolve(undefined);
722 }
724 > next(granularity?: DebugProtocol.SteppingGranularity): Promise<void> {
725 return this.session.next(this.threadId, granularity);
726 }
728 > stepIn(granularity?: DebugProtocol.SteppingGranularity): Promise<void> {
729 return this.session.stepIn(this.threadId, undefined, granularity);
730 }
732 > stepOut(granularity?: DebugProtocol.SteppingGranularity): Promise<void> {
733 return this.session.stepOut(this.threadId, granularity);
734 }
736 > stepBack(granularity?: DebugProtocol.SteppingGranularity): Promise<void> {
737 return this.session.stepBack(this.threadId, granularity);
738 }
740 > continue(): Promise<void> {
741 return this.session.continue(this.threadId);
742 }
744 > pause(): Promise<void> {
745 return this.session.pause(this.threadId);
746 }
748 > terminate(): Promise<void> {
749 return this.session.terminateThreads([this.threadId]);
750 }
752 > reverseContinue(): Promise<void> {
753 return this.session.reverseContinue(this.threadId);
754 }
755 > } debugModel.ts
756 >
757 > /**
758 > * Gets a URI to a memory in the given session ID.
759 > */
760 > export const getUriForDebugMemory = (
761 sessionId: string,
762 memoryReference: string,
771 });
772 };
774 > export class MemoryRegion extends Disposable implements IMemoryRegion {
775 > private readonly invalidateEmitter = this._register(new Emitter<IMemoryInvalidationEvent>());
776 >
777 > /** @inheritdoc */
778 > public readonly onDidInvalidate = this.invalidateEmitter.event;
779 >
780 > /** @inheritdoc */
781 > public readonly writable: boolean;
782 >
783 > constructor(private readonly memoryReference: string, private readonly session: IDebugSession) {
784 super();
785 this.writable = !!this.session.capabilities.supportsWriteMemoryRequest;
790 }));
791 }
793 > public async read(fromOffset: number, toOffset: number): Promise<MemoryRange[]> {
794 const length = toOffset - fromOffset;
795 const offset = fromOffset;
826 ];
827 }
829 > public async write(offset: number, data: VSBuffer): Promise<number> {
830 const result = await this.session.writeMemory(this.memoryReference, offset, encodeBase64(data), true);
831 const written = result?.body?.bytesWritten ?? data.byteLength;
833 return written;
834 }
836 > public override dispose() {
837 super.dispose();
838 }
840 > private invalidate(fromOffset: number, toOffset: number) {
841 this.invalidateEmitter.fire({ fromOffset, toOffset });
842 }
843 > } debugModel.ts
844 >
845 > export class Enablement implements IEnablement {
846 > constructor(
847 public enabled: boolean,
848 private readonly id: string
849 ) { }
851 > getId(): string {
852 return this.id;
853 }
854 > } debugModel.ts
855 >
856 > interface IBreakpointSessionData extends DebugProtocol.Breakpoint {
857 > supportsConditionalBreakpoints: boolean;
858 > supportsHitConditionalBreakpoints: boolean;
859 > supportsLogPoints: boolean;
860 > supportsFunctionBreakpoints: boolean;
861 > supportsDataBreakpoints: boolean;
862 > supportsInstructionBreakpoints: boolean;
863 > sessionId: string;
864 > }
865 >
866 function toBreakpointSessionData(data: DebugProtocol.Breakpoint, capabilities: DebugProtocol.Capabilities): IBreakpointSessionData {
867 return mixin({
874 }, data);
875 }
877 > export interface IBaseBreakpointOptions {
878 > enabled?: boolean;
879 > hitCondition?: string;
880 > condition?: string;
881 > logMessage?: string;
882 > mode?: string;
883 > modeLabel?: string;
884 > }
885 >
886 > export abstract class BaseBreakpoint extends Enablement implements IBaseBreakpoint {
887 >
888 > private sessionData = new Map<string, IBreakpointSessionData>();
889 > protected data: IBreakpointSessionData | undefined;
890 > public hitCondition: string | undefined;
891 > public condition: string | undefined;
892 > public logMessage: string | undefined;
893 > public mode: string | undefined;
894 > public modeLabel: string | undefined;
895 >
896 > constructor(
897 id: string,
898 opts: IBaseBreakpointOptions
905 this.modeLabel = opts.modeLabel;
906 }
908 > setSessionData(sessionId: string, data: IBreakpointSessionData | undefined): void {
909 if (!data) {
910 this.sessionData.delete(sessionId);
924 }
925 }
927 > get message(): string | undefined {
928 if (!this.data) {
929 return undefined;
932 return this.data.message;
933 }
935 > get verified(): boolean {
936 return this.data ? this.data.verified : true;
937 }
939 > get sessionsThatVerified() {
940 const sessionIds: string[] = [];
941 for (const [sessionId, data] of this.sessionData) {
947 return sessionIds;
948 }
950 > abstract get supported(): boolean;
951 >
952 > getIdFromAdapter(sessionId: string): number | undefined {
953 const data = this.sessionData.get(sessionId);
954 return data ? data.id : undefined;
955 }
957 > getDebugProtocolBreakpoint(sessionId: string): DebugProtocol.Breakpoint | undefined {
958 const data = this.sessionData.get(sessionId);
959 if (data) {
974 return undefined;
975 }
977 > toJSON(): IBaseBreakpointOptions & { id: string } {
978 return {
979 id: this.getId(),
986 };
987 }
988 > } debugModel.ts
989 >
990 > export interface IBreakpointOptions extends IBaseBreakpointOptions {
991 > uri: uri;
992 > lineNumber: number;
993 > column: number | undefined;
994 > adapterData: unknown;
995 > triggeredBy: string | undefined;
996 > }
997 >
998 > export class Breakpoint extends BaseBreakpoint implements IBreakpoint {
999 > private sessionsDidTrigger?: Set<string>;
1000 > private readonly _uri: uri;
1001 > private _adapterData: unknown;
1002 > private _lineNumber: number;
1003 > private _column: number | undefined;
1004 > public triggeredBy: string | undefined;
1005 >
1006 > constructor(
1007 opts: IBreakpointOptions,
1008 private readonly textFileService: ITextFileService,
1018 this.triggeredBy = opts.triggeredBy;
1019 }
1020 > debugModel.ts
1021 > toDAP(): DebugProtocol.SourceBreakpoint {
1022 return {
1023 line: this.sessionAgnosticData.lineNumber,
1029 };
1030 }
1031 > debugModel.ts
1032 > get originalUri() {
1033 return this._uri;
1034 }
1035 > debugModel.ts
1036 > get lineNumber(): number {
1037 return this.verified && this.data && typeof this.data.line === 'number' ? this.data.line : this._lineNumber;
1038 }
1039 > debugModel.ts
1040 > override get verified(): boolean {
1041 if (this.data) {
1042 return this.data.verified && !this.textFileService.isDirty(this._uri);
1045 return true;
1046 }
1047 > debugModel.ts
1048 > get pending(): boolean {
1049 if (this.data) {
1050 return false;
1052 return this.triggeredBy !== undefined;
1053 }
1054 > debugModel.ts
1055 > get uri(): uri {
1056 return this.verified && this.data && this.data.source ? getUriFromSource(this.data.source, this.data.source.path, this.data.sessionId, this.uriIdentityService, this.logService) : this._uri;
1057 }
1058 > debugModel.ts
1059 > get column(): number | undefined {
1060 return this.verified && this.data && typeof this.data.column === 'number' ? this.data.column : this._column;
1061 }
1062 > debugModel.ts
1063 > override get message(): string | undefined {
1064 if (this.textFileService.isDirty(this.uri)) {
1065 return nls.localize('breakpointDirtydHover', "Unverified breakpoint. File is modified, please restart debug session.");
1068 return super.message;
1069 }
1070 > debugModel.ts
1071 > get adapterData(): unknown {
1072 return this.data && this.data.source && this.data.source.adapterData ? this.data.source.adapterData : this._adapterData;
1073 }
1074 > debugModel.ts
1075 > get endLineNumber(): number | undefined {
1076 return this.verified && this.data ? this.data.endLine : undefined;
1077 }
1078 > debugModel.ts
1079 > get endColumn(): number | undefined {
1080 return this.verified && this.data ? this.data.endColumn : undefined;
1081 }
1082 > debugModel.ts
1083 > get sessionAgnosticData(): { lineNumber: number; column: number | undefined } {
1084 return {
1085 lineNumber: this._lineNumber,
1087 };
1088 }
1089 > debugModel.ts
1090 > get supported(): boolean {
1091 if (!this.data) {
1092 return true;
1104 return true;
1105 }
1106 > debugModel.ts
1107 > override setSessionData(sessionId: string, data: IBreakpointSessionData | undefined): void {
1108 super.setSessionData(sessionId, data);
1109 if (!this._adapterData) {
1111 }
1112 }
1113 > debugModel.ts
1114 > override toJSON(): IBreakpointOptions & { id: string } {
1115 return {
1116 ...super.toJSON(),
1122 };
1123 }
1124 > debugModel.ts
1125 > override toString(): string {
1126 return `${resources.basenameOrAuthority(this.uri)} ${this.lineNumber}`;
1127 }
1128 > debugModel.ts
1129 > public setSessionDidTrigger(sessionId: string, didTrigger = true): void {
1130 if (didTrigger) {
1131 this.sessionsDidTrigger ??= new Set();
1135 }
1136 }
1137 > debugModel.ts
1138 > public getSessionDidTrigger(sessionId: string): boolean {
1139 return !!this.sessionsDidTrigger?.has(sessionId);
1140 }
1141 > debugModel.ts
1142 > update(data: IBreakpointUpdateData): void {
1143 if (data.hasOwnProperty('lineNumber') && !isUndefinedOrNull(data.lineNumber)) {
1144 this._lineNumber = data.lineNumber;
1165 }
1166 }
1167 > } debugModel.ts
1168 >
1169 > export interface IFunctionBreakpointOptions extends IBaseBreakpointOptions {
1170 > name: string;
1171 > }
1172 >
1173 > export class FunctionBreakpoint extends BaseBreakpoint implements IFunctionBreakpoint {
1174 > public name: string;
1175 >
1176 > constructor(
1177 opts: IFunctionBreakpointOptions,
1178 id = generateUuid()
1181 this.name = opts.name;
1182 }
1183 > debugModel.ts
1184 > toDAP(): DebugProtocol.FunctionBreakpoint {
1185 return {
1186 name: this.name,
1189 };
1190 }
1191 > debugModel.ts
1192 > override toJSON(): IFunctionBreakpointOptions & { id: string } {
1193 return {
1194 ...super.toJSON(),
1196 };
1197 }
1198 > debugModel.ts
1199 > get supported(): boolean {
1200 if (!this.data) {
1201 return true;
1204 return this.data.supportsFunctionBreakpoints;
1205 }
1206 > debugModel.ts
1207 > override toString(): string {
1208 return this.name;
1209 }
1210 > } debugModel.ts
1211 >
1212 > export interface IDataBreakpointOptions extends IBaseBreakpointOptions {
1213 > description: string;
1214 > src: DataBreakpointSource;
1215 > canPersist: boolean;
1216 > initialSessionData?: { session: IDebugSession; dataId: string };
1217 > accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined;
1218 > accessType: DebugProtocol.DataBreakpointAccessType;
1219 > }
1220 >
1221 > export class DataBreakpoint extends BaseBreakpoint implements IDataBreakpoint {
1222 > private readonly sessionDataIdForAddr = new WeakMap<IDebugSession, string | null>();
1223 >
1224 > public readonly description: string;
1225 > public readonly src: DataBreakpointSource;
1226 > public readonly canPersist: boolean;
1227 > public readonly accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined;
1228 > public readonly accessType: DebugProtocol.DataBreakpointAccessType;
1229 >
1230 > constructor(
1231 opts: IDataBreakpointOptions,
1232 id = generateUuid()
1245 }
1246 }
1247 > debugModel.ts
1248 > async toDAP(session: IDebugSession): Promise<DebugProtocol.DataBreakpoint | undefined> {
1249 let dataId: string;
1250 if (this.src.type === DataBreakpointSetType.Variable) {
1269 };
1270 }
1271 > debugModel.ts
1272 > override toJSON(): IDataBreakpointOptions & { id: string } {
1273 return {
1274 ...super.toJSON(),
1280 };
1281 }
1282 > debugModel.ts
1283 > get supported(): boolean {
1284 if (!this.data) {
1285 return true;
1288 return this.data.supportsDataBreakpoints;
1289 }
1290 > debugModel.ts
1291 > override toString(): string {
1292 return this.description;
1293 }
1294 > } debugModel.ts
1295 >
1296 > export interface IExceptionBreakpointOptions extends IBaseBreakpointOptions {
1297 > filter: string;
1298 > label: string;
1299 > supportsCondition: boolean;
1300 > description: string | undefined;
1301 > conditionDescription: string | undefined;
1302 > fallback?: boolean;
1303 > }
1304 >
1305 > export class ExceptionBreakpoint extends BaseBreakpoint implements IExceptionBreakpoint {
1306 >
1307 > private supportedSessions: Set<string> = new Set();
1308 >
1309 > public readonly filter: string;
1310 > public readonly label: string;
1311 > public readonly supportsCondition: boolean;
1312 > public readonly description: string | undefined;
1313 > public readonly conditionDescription: string | undefined;
1314 > private fallback: boolean = false;
1315 >
1316 > constructor(
1317 opts: IExceptionBreakpointOptions,
1318 id = generateUuid(),
1326 this.fallback = opts.fallback || false;
1327 }
1328 > debugModel.ts
1329 > override toJSON(): IExceptionBreakpointOptions & { id: string } {
1330 return {
1331 ...super.toJSON(),
1340 };
1341 }
1342 > debugModel.ts
1343 > setSupportedSession(sessionId: string, supported: boolean): void {
1344 if (supported) {
1345 this.supportedSessions.add(sessionId);
1349 }
1350 }
1351 > debugModel.ts
1352 > /**
1353 > * Used to specify which breakpoints to show when no session is specified.
1354 > * Useful when no session is active and we want to show the exception breakpoints from the last session.
1355 > */
1356 > setFallback(isFallback: boolean) {
1357 this.fallback = isFallback;
1358 }
1359 > debugModel.ts
1360 > get supported(): boolean {
1361 return true;
1362 }
1363 > debugModel.ts
1364 > /**
1365 > * Checks if the breakpoint is applicable for the specified session.
1366 > * If sessionId is undefined, returns true if this breakpoint is a fallback breakpoint.
1367 > */
1368 > isSupportedSession(sessionId?: string): boolean {
1369 return sessionId ? this.supportedSessions.has(sessionId) : this.fallback;
1370 }
1371 > debugModel.ts
1372 > matches(filter: DebugProtocol.ExceptionBreakpointsFilter) {
1373 return this.filter === filter.filter
1374 && this.label === filter.label
1377 && this.description === filter.description;
1378 }
1379 > debugModel.ts
1380 > override toString(): string {
1381 return this.label;
1382 }
1383 > } debugModel.ts
1384 >
1385 > export interface IInstructionBreakpointOptions extends IBaseBreakpointOptions {
1386 > instructionReference: string;
1387 > offset: number;
1388 > canPersist: boolean;
1389 > address: bigint;
1390 > }
1391 >
1392 > export class InstructionBreakpoint extends BaseBreakpoint implements IInstructionBreakpoint {
1393 > public readonly instructionReference: string;
1394 > public readonly offset: number;
1395 > public readonly canPersist: boolean;
1396 > public readonly address: bigint;
1397 >
1398 > constructor(
1399 opts: IInstructionBreakpointOptions,
1400 id = generateUuid()
1406 this.address = opts.address;
1407 }
1408 > debugModel.ts
1409 > toDAP(): DebugProtocol.InstructionBreakpoint {
1410 return {
1411 instructionReference: this.instructionReference,
1416 };
1417 }
1418 > debugModel.ts
1419 > override toJSON(): IInstructionBreakpointOptions & { id: string } {
1420 return {
1421 ...super.toJSON(),
1426 };
1427 }
1428 > debugModel.ts
1429 > get supported(): boolean {
1430 if (!this.data) {
1431 return true;
1434 return this.data.supportsInstructionBreakpoints;
1435 }
1436 > debugModel.ts
1437 > override toString(): string {
1438 return this.instructionReference;
1439 }
1440 > } debugModel.ts
1441 >
1442 > export class ThreadAndSessionIds implements ITreeElement {
1443 > constructor(public sessionId: string, public threadId: number) { }
1444 >
1445 > getId(): string {
1446 return `${this.sessionId}:${this.threadId}`;
1447 }
1448 > } debugModel.ts
1449 >
1450 > interface IBreakpointModeInternal extends DebugProtocol.BreakpointMode {
1451 > firstFromDebugType: string;
1452 > }
1453 >
1454 > export class DebugModel extends Disposable implements IDebugModel {
1455 >
1456 > private sessions: IDebugSession[];
1457 > private schedulers = new Map<string, { scheduler: RunOnceScheduler; completeDeferred: DeferredPromise<void> }>();
1458 > private breakpointsActivated = true;
1459 > private readonly _onDidChangeBreakpoints = this._register(new Emitter<IBreakpointsChangeEvent | undefined>());
1460 > private readonly _onDidChangeCallStack = this._register(new Emitter<void>());
1461 > private _onDidChangeCallStackFire = this._register(new RunOnceScheduler(() => {
1462 this._onDidChangeCallStack.fire(undefined);
1463 > }, 100)); debugModel.ts
1464 > private readonly _onDidChangeWatchExpressions = this._register(new Emitter<IExpression | undefined>());
1465 > private readonly _onDidChangeWatchExpressionValue = this._register(new Emitter<IExpression | undefined>());
1466 > private readonly _breakpointModes = new Map<string, IBreakpointModeInternal>();
1467 > private breakpoints!: Breakpoint[];
1468 > private functionBreakpoints!: FunctionBreakpoint[];
1469 > private exceptionBreakpoints!: ExceptionBreakpoint[];
1470 > private dataBreakpoints!: DataBreakpoint[];
1471 > private watchExpressions!: Expression[];
1472 > private instructionBreakpoints: InstructionBreakpoint[];
1473 >
1474 > constructor(
1475 debugStorage: DebugStorage,
1476 @ITextFileService private readonly textFileService: ITextFileService,
1502 this.sessions = [];
1503 }
1504 > debugModel.ts
1505 > getId(): string {
1506 return 'root';
1507 }
1508 > debugModel.ts
1509 > getSession(sessionId: string | undefined, includeInactive = false): IDebugSession | undefined {
1510 if (sessionId) {
1511 return this.getSessions(includeInactive).find(s => s.getId() === sessionId);
1513 return undefined;
1514 }
1515 > debugModel.ts
1516 > getSessions(includeInactive = false): IDebugSession[] {
1517 // By default do not return inactive sessions.
1518 // However we are still holding onto inactive sessions due to repl and debug service session revival (eh scenario)
1519 return this.sessions.filter(s => includeInactive || s.state !== State.Inactive);
1520 }
1521 > debugModel.ts
1522 > private shouldDisposeSession(session: IDebugSession, newSession: IDebugSession): boolean {
1523 if (session.state !== State.Inactive) {
1524 return false;
1536 return rootSession.state === State.Inactive && rootSession.configuration.name === newSession.configuration.name;
1537 }
1538 > debugModel.ts
1539 > addSession(session: IDebugSession): void {
1540 this.sessions = this.sessions.filter(s => {
1541 if (s.getId() === session.getId()) {
1569 this._onDidChangeCallStack.fire(undefined);
1570 }
1571 > debugModel.ts
1572 > get onDidChangeBreakpoints(): Event<IBreakpointsChangeEvent | undefined> {
1573 return this._onDidChangeBreakpoints.event;
1574 }
1575 > debugModel.ts
1576 > get onDidChangeCallStack(): Event<void> {
1577 return this._onDidChangeCallStack.event;
1578 }
1579 > debugModel.ts
1580 > get onDidChangeWatchExpressions(): Event<IExpression | undefined> {
1581 return this._onDidChangeWatchExpressions.event;
1582 }
1583 > debugModel.ts
1584 > get onDidChangeWatchExpressionValue(): Event<IExpression | undefined> {
1585 return this._onDidChangeWatchExpressionValue.event;
1586 }
1587 > debugModel.ts
1588 > rawUpdate(data: IRawModelUpdate): void {
1589 const session = this.sessions.find(p => p.getId() === data.sessionId);
1590 if (session) {
1593 }
1594 }
1595 > debugModel.ts
1596 > clearThreads(id: string, removeThreads: boolean, reference: number | undefined = undefined): void {
1597 const session = this.sessions.find(p => p.getId() === id);
1598 if (session) {
1620 }
1621 }
1622 > debugModel.ts
1623 > /**
1624 > * Update the call stack and notify the call stack view that changes have occurred.
1625 > */
1626 > async fetchCallstack(thread: IThread, levels?: number): Promise<void> {
1627
1628 if ((<Thread>thread).reachedEndOfCallStack) {
1644 return;
1645 }
1646 > debugModel.ts
1647 > refreshTopOfCallstack(thread: Thread, fetchFullStack = true): { topCallStack: Promise<void>; wholeCallStack: Promise<void> } {
1648 if (thread.session.capabilities.supportsDelayedStackTraceLoading) {
1649 // For improved performance load the first stack frame and then load the rest async.
1694 return { wholeCallStack, topCallStack: wholeCallStack };
1695 }
1696 > debugModel.ts
1697 > getBreakpoints(filter?: { uri?: uri; originalUri?: uri; lineNumber?: number; column?: number; enabledOnly?: boolean; triggeredOnly?: boolean }): IBreakpoint[] {
1698 if (filter) {
1699 const uriStr = filter.uri?.toString();
1725 return this.breakpoints;
1726 }
1727 > debugModel.ts
1728 > getFunctionBreakpoints(): IFunctionBreakpoint[] {
1729 return this.functionBreakpoints;
1730 }
1731 > debugModel.ts
1732 > getDataBreakpoints(): IDataBreakpoint[] {
1733 return this.dataBreakpoints;
1734 }
1735 > debugModel.ts
1736 > getExceptionBreakpoints(): IExceptionBreakpoint[] {
1737 return this.exceptionBreakpoints;
1738 }
1739 > debugModel.ts
1740 > getExceptionBreakpointsForSession(sessionId?: string): IExceptionBreakpoint[] {
1741 return this.exceptionBreakpoints.filter(ebp => ebp.isSupportedSession(sessionId));
1742 }
1743 > debugModel.ts
1744 > getInstructionBreakpoints(): IInstructionBreakpoint[] {
1745 return this.instructionBreakpoints;
1746 }
1747 > debugModel.ts
1748 > setExceptionBreakpointsForSession(sessionId: string, filters: DebugProtocol.ExceptionBreakpointsFilter[]): void {
1749 if (!filters) {
1750 return;
1775 }
1776 }
1777 > debugModel.ts
1778 > removeExceptionBreakpointsForSession(sessionId: string): void {
1779 this.exceptionBreakpoints.forEach(ebp => ebp.setSupportedSession(sessionId, false));
1780 }
1781 > debugModel.ts
1782 > // Set last focused session as fallback session.
1783 > // This is done to keep track of the exception breakpoints to show when no session is active.
1784 > setExceptionBreakpointFallbackSession(sessionId: string): void {
1785 this.exceptionBreakpoints.forEach(ebp => ebp.setFallback(ebp.isSupportedSession(sessionId)));
1786 }
1787 > debugModel.ts
1788 > setExceptionBreakpointCondition(exceptionBreakpoint: IExceptionBreakpoint, condition: string | undefined): void {
1789 (exceptionBreakpoint as ExceptionBreakpoint).condition = condition;
1790 this._onDidChangeBreakpoints.fire(undefined);
1791 }
1792 > debugModel.ts
1793 > areBreakpointsActivated(): boolean {
1794 return this.breakpointsActivated;
1795 }
1796 > debugModel.ts
1797 > setBreakpointsActivated(activated: boolean): void {
1798 this.breakpointsActivated = activated;
1799 this._onDidChangeBreakpoints.fire(undefined);
1800 }
1801 > debugModel.ts
1802 > addBreakpoints(uri: uri, rawData: IBreakpointData[], fireEvent = true): IBreakpoint[] {
1803 const newBreakpoints = rawData.map(rawBp => {
1804 return new Breakpoint({
1826 return newBreakpoints;
1827 }
1828 > debugModel.ts
1829 > removeBreakpoints(toRemove: IBreakpoint[]): void {
1830 this.breakpoints = this.breakpoints.filter(bp => !toRemove.some(toRemove => toRemove.getId() === bp.getId()));
1831 this._onDidChangeBreakpoints.fire({ removed: toRemove, sessionOnly: false });
1832 }
1833 > debugModel.ts
1834 > updateBreakpoints(data: Map<string, IBreakpointUpdateData>): void {
1835 const updated: IBreakpoint[] = [];
1836 this.breakpoints.forEach(bp => {
1844 this._onDidChangeBreakpoints.fire({ changed: updated, sessionOnly: false });
1845 }
1846 > debugModel.ts
1847 > setBreakpointSessionData(sessionId: string, capabilites: DebugProtocol.Capabilities, data: Map<string, DebugProtocol.Breakpoint> | undefined): void {
1848 this.breakpoints.forEach(bp => {
1849 if (!data) {
1901 });
1902 }
1903 > debugModel.ts
1904 > getDebugProtocolBreakpoint(breakpointId: string, sessionId: string): DebugProtocol.Breakpoint | undefined {
1905 const bp = this.breakpoints.find(bp => bp.getId() === breakpointId);
1906 if (bp) {
1909 return undefined;
1910 }
1911 > debugModel.ts
1912 > getBreakpointModes(forBreakpointType: 'source' | 'exception' | 'data' | 'instruction'): DebugProtocol.BreakpointMode[] {
1913 return [...this._breakpointModes.values()].filter(mode => mode.appliesTo.includes(forBreakpointType));
1914 }
1915 > debugModel.ts
1916 > registerBreakpointModes(debugType: string, modes: DebugProtocol.BreakpointMode[]) {
1917 for (const mode of modes) {
1918 const key = `${mode.mode}/${mode.label}`;
1940 }
1941 }
1942 > debugModel.ts
1943 > private sortAndDeDup(): void {
1944 this.breakpoints = this.breakpoints.sort((first, second) => {
1945 if (first.uri.toString() !== second.uri.toString()) {
1957 this.breakpoints = distinct(this.breakpoints, bp => `${bp.uri.toString()}:${bp.lineNumber}:${bp.column}`);
1958 }
1959 > debugModel.ts
1960 > setEnablement(element: IEnablement, enable: boolean): void {
1961 if (element instanceof Breakpoint || element instanceof FunctionBreakpoint || element instanceof ExceptionBreakpoint || element instanceof DataBreakpoint || element instanceof InstructionBreakpoint) {
1962 const changed: Array<IBreakpoint | IFunctionBreakpoint | IDataBreakpoint | IInstructionBreakpoint> = [];
1973 }
1974 }
1975 > debugModel.ts
1976 > enableOrDisableAllBreakpoints(enable: boolean): void {
1977 const changed: Array<IBreakpoint | IFunctionBreakpoint | IDataBreakpoint | IInstructionBreakpoint> = [];
1978
2008 this._onDidChangeBreakpoints.fire({ changed: changed, sessionOnly: false });
2009 }
2010 > debugModel.ts
2011 > addFunctionBreakpoint(opts: IFunctionBreakpointOptions, id?: string): IFunctionBreakpoint {
2012 const newFunctionBreakpoint = new FunctionBreakpoint(opts, id);
2013 this.functionBreakpoints.push(newFunctionBreakpoint);
2016 return newFunctionBreakpoint;
2017 }
2018 > debugModel.ts
2019 > updateFunctionBreakpoint(id: string, update: { name?: string; hitCondition?: string; condition?: string }): void {
2020 const functionBreakpoint = this.functionBreakpoints.find(fbp => fbp.getId() === id);
2021 if (functionBreakpoint) {
2032 }
2033 }
2034 > debugModel.ts
2035 > removeFunctionBreakpoints(id?: string): void {
2036 let removed: FunctionBreakpoint[];
2037 if (id) {
2044 this._onDidChangeBreakpoints.fire({ removed, sessionOnly: false });
2045 }
2046 > debugModel.ts
2047 > addDataBreakpoint(opts: IDataBreakpointOptions, id?: string): void {
2048 const newDataBreakpoint = new DataBreakpoint(opts, id);
2049 this.dataBreakpoints.push(newDataBreakpoint);
2050 this._onDidChangeBreakpoints.fire({ added: [newDataBreakpoint], sessionOnly: false });
2051 }
2052 > debugModel.ts
2053 > updateDataBreakpoint(id: string, update: { hitCondition?: string; condition?: string }): void {
2054 const dataBreakpoint = this.dataBreakpoints.find(fbp => fbp.getId() === id);
2055 if (dataBreakpoint) {
2063 }
2064 }
2065 > debugModel.ts
2066 > removeDataBreakpoints(id?: string): void {
2067 let removed: DataBreakpoint[];
2068 if (id) {
2075 this._onDidChangeBreakpoints.fire({ removed, sessionOnly: false });
2076 }
2077 > debugModel.ts
2078 > addInstructionBreakpoint(opts: IInstructionBreakpointOptions): void {
2079 const newInstructionBreakpoint = new InstructionBreakpoint(opts);
2080 this.instructionBreakpoints.push(newInstructionBreakpoint);
2081 this._onDidChangeBreakpoints.fire({ added: [newInstructionBreakpoint], sessionOnly: true });
2082 }
2083 > debugModel.ts
2084 > removeInstructionBreakpoints(instructionReference?: string, offset?: number, address?: bigint): void {
2085 let removed: InstructionBreakpoint[] = [];
2086 if (address !== undefined) {
2112 this._onDidChangeBreakpoints.fire({ removed, sessionOnly: false });
2113 }
2114 > debugModel.ts
2115 > getWatchExpressions(): Expression[] {
2116 return this.watchExpressions;
2117 }
2118 > debugModel.ts
2119 > addWatchExpression(name?: string): IExpression {
2120 const we = new Expression(name || '');
2121 this.watchExpressions.push(we);
2124 return we;
2125 }
2126 > debugModel.ts
2127 > renameWatchExpression(id: string, newName: string): void {
2128 const filtered = this.watchExpressions.filter(we => we.getId() === id);
2129 if (filtered.length === 1) {
2132 }
2133 }
2134 > debugModel.ts
2135 > removeWatchExpressions(id: string | null = null): void {
2136 this.watchExpressions = id ? this.watchExpressions.filter(we => we.getId() !== id) : [];
2137 this._onDidChangeWatchExpressions.fire(undefined);
2138 }
2139 > debugModel.ts
2140 > moveWatchExpression(id: string, position: number): void {
2141 const we = this.watchExpressions.find(we => we.getId() === id);
2142 if (we) {
2146 }
2147 }
2148 > debugModel.ts
2149 > sourceIsNotAvailable(uri: uri): void {
2150 this.sessions.forEach(s => {
2151 const source = s.getSourceForUri(uri);
2156 this._onDidChangeCallStack.fire(undefined);
2157 }
2158 > } debugModel.ts
src/vs/workbench/contrib/debug/test/common/mockDebug.ts 213 introduced LOC · 99 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- mockDebug.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { DeferredPromise } from '../../../../../base/common/async.js';
7 > import { CancellationToken } from '../../../../../base/common/cancellation.js';
8 > import { Event } from '../../../../../base/common/event.js';
9 > import { URI as uri } from '../../../../../base/common/uri.js';
10 > import { IPosition, Position } from '../../../../../editor/common/core/position.js';
11 > import { ITextModel } from '../../../../../editor/common/model.js';
12 > import { NullLogService } from '../../../../../platform/log/common/log.js';
13 > import { IStorageService } from '../../../../../platform/storage/common/storage.js';
14 > import { IWorkspaceFolder } from '../../../../../platform/workspace/common/workspace.js';
15 > import { AbstractDebugAdapter } from '../../common/abstractDebugAdapter.js';
16 > import { AdapterEndEvent, IAdapterManager, IBreakpoint, IBreakpointData, IBreakpointUpdateData, IConfig, IConfigurationManager, IDataBreakpoint, IDataBreakpointInfoResponse, IDebugLocationReferenced, IDebugModel, IDebugService, IDebugSession, IDebugSessionOptions, IDebugger, IExceptionBreakpoint, IExceptionInfo, IFunctionBreakpoint, IInstructionBreakpoint, ILaunch, IMemoryRegion, INewReplElementData, IRawModelUpdate, IRawStoppedDetails, IReplElement, IStackFrame, IThread, IViewModel, LoadedSourceEvent, State } from '../../common/debug.js';
17 > import { DebugCompoundRoot } from '../../common/debugCompoundRoot.js';
18 > import { IInstructionBreakpointOptions } from '../../common/debugModel.js';
19 > import { Source } from '../../common/debugSource.js';
20 > import { DebugStorage } from '../../common/debugStorage.js';
21 >
22 > export class MockDebugService implements IDebugService {
23 > _serviceBrand: undefined;
24 >
25 > get state(): State {
26 throw new Error('not implemented');
27 }
29 > get onWillNewSession(): Event<IDebugSession> {
30 throw new Error('not implemented');
31 }
33 > get onDidNewSession(): Event<IDebugSession> {
34 throw new Error('not implemented');
35 }
37 > get onDidEndSession(): Event<{ session: IDebugSession; restart: boolean }> {
38 throw new Error('not implemented');
39 }
41 > get onDidChangeState(): Event<State> {
42 throw new Error('not implemented');
43 }
45 > getConfigurationManager(): IConfigurationManager {
46 throw new Error('not implemented');
47 }
49 > getAdapterManager(): IAdapterManager {
50 throw new Error('Method not implemented.');
51 }
53 > canSetBreakpointsIn(model: ITextModel): boolean {
54 throw new Error('Method not implemented.');
55 }
57 > focusStackFrame(focusedStackFrame: IStackFrame): Promise<void> {
58 throw new Error('not implemented');
59 }
61 > sendAllBreakpoints(session?: IDebugSession): Promise<any> {
62 throw new Error('not implemented');
63 }
65 > sendBreakpoints(modelUri: uri, sourceModified?: boolean | undefined, session?: IDebugSession | undefined): Promise<any> {
66 throw new Error('not implemented');
67 }
69 > addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[]): Promise<IBreakpoint[]> {
70 throw new Error('not implemented');
71 }
73 > updateBreakpoints(uri: uri, data: Map<string, IBreakpointUpdateData>, sendOnResourceSaved: boolean): Promise<void> {
74 throw new Error('not implemented');
75 }
77 > enableOrDisableBreakpoints(enabled: boolean): Promise<void> {
78 throw new Error('not implemented');
79 }
81 > setBreakpointsActivated(): Promise<void> {
82 throw new Error('not implemented');
83 }
85 > removeBreakpoints(): Promise<any> {
86 throw new Error('not implemented');
87 }
89 > addInstructionBreakpoint(opts: IInstructionBreakpointOptions): Promise<void> {
90 throw new Error('Method not implemented.');
91 }
93 > removeInstructionBreakpoints(address?: string): Promise<void> {
94 throw new Error('Method not implemented.');
95 }
97 > setExceptionBreakpointCondition(breakpoint: IExceptionBreakpoint, condition: string): Promise<void> {
98 throw new Error('Method not implemented.');
99 }
100 > mockDebug.ts
101 > setExceptionBreakpointsForSession(session: IDebugSession, data: DebugProtocol.ExceptionBreakpointsFilter[]): void {
102 throw new Error('Method not implemented.');
103 }
104 > mockDebug.ts
105 > addFunctionBreakpoint(): void { }
106 >
107 > moveWatchExpression(id: string, position: number): void { }
108 >
109 > updateFunctionBreakpoint(id: string, update: { name?: string; hitCondition?: string; condition?: string }): Promise<void> {
110 throw new Error('not implemented');
111 }
112 > mockDebug.ts
113 > removeFunctionBreakpoints(id?: string): Promise<void> {
114 throw new Error('not implemented');
115 }
116 > mockDebug.ts
117 > addDataBreakpoint(): Promise<void> {
118 throw new Error('Method not implemented.');
119 }
120 > mockDebug.ts
121 > updateDataBreakpoint(id: string, update: { hitCondition?: string; condition?: string }): Promise<void> {
122 throw new Error('not implemented');
123 }
124 > mockDebug.ts
125 > removeDataBreakpoints(id?: string | undefined): Promise<void> {
126 throw new Error('Method not implemented.');
127 }
128 > mockDebug.ts
129 > addReplExpression(name: string): Promise<void> {
130 throw new Error('not implemented');
131 }
132 > mockDebug.ts
133 > removeReplExpressions(): void { }
134 >
135 > addWatchExpression(name?: string): Promise<void> {
136 throw new Error('not implemented');
137 }
138 > mockDebug.ts
139 > renameWatchExpression(id: string, newName: string): Promise<void> {
140 throw new Error('not implemented');
141 }
142 > mockDebug.ts
143 > removeWatchExpressions(id?: string): void { }
144 >
145 > startDebugging(launch: ILaunch, configOrName?: IConfig | string, options?: IDebugSessionOptions): Promise<boolean> {
146 return Promise.resolve(true);
147 }
148 > mockDebug.ts
149 > restartSession(): Promise<any> {
150 throw new Error('not implemented');
151 }
152 > mockDebug.ts
153 > stopSession(): Promise<any> {
154 throw new Error('not implemented');
155 }
156 > mockDebug.ts
157 > getModel(): IDebugModel {
158 throw new Error('not implemented');
159 }
160 > mockDebug.ts
161 > getViewModel(): IViewModel {
162 throw new Error('not implemented');
163 }
164 > mockDebug.ts
165 > sourceIsNotAvailable(uri: uri): void { }
166 >
167 > tryToAutoFocusStackFrame(thread: IThread): Promise<any> {
168 throw new Error('not implemented');
169 }
170 > mockDebug.ts
171 > runTo(uri: uri, lineNumber: number, column?: number): Promise<void> {
172 throw new Error('Method not implemented.');
173 }
174 > } mockDebug.ts
175 >
176 > export class MockSession implements IDebugSession {
177 readonly suppressDebugToolbar = false;
178 readonly suppressDebugStatusbar = false;
282 root!: IWorkspaceFolder;
283 capabilities: DebugProtocol.Capabilities = {};
284 > mockDebug.ts
285 > getId(): string {
286 return 'mock';
287 }
288 > mockDebug.ts
289 > getLabel(): string {
290 return 'mockname';
291 }
292 > mockDebug.ts
293 > get name(): string {
294 return 'mockname';
295 }
296 > mockDebug.ts
297 > setName(name: string): void {
298 throw new Error('not implemented');
299 }
300 > mockDebug.ts
301 > getSourceForUri(modelUri: uri): Source {
302 throw new Error('not implemented');
303 }
304 > mockDebug.ts
305 > getThread(threadId: number): IThread {
306 throw new Error('not implemented');
307 }
308 > mockDebug.ts
309 > getStoppedDetails(): IRawStoppedDetails {
310 throw new Error('not implemented');
311 }
312 > mockDebug.ts
313 > get onDidCustomEvent(): Event<DebugProtocol.Event> {
314 throw new Error('not implemented');
315 }
316 > mockDebug.ts
317 > get onDidLoadedSource(): Event<LoadedSourceEvent> {
318 throw new Error('not implemented');
319 }
320 > mockDebug.ts
321 > get onDidChangeState(): Event<void> {
322 throw new Error('not implemented');
323 }
324 > mockDebug.ts
325 > get onDidEndAdapter(): Event<AdapterEndEvent | undefined> {
326 throw new Error('not implemented');
327 }
328 > mockDebug.ts
329 > get onDidChangeName(): Event<string> {
330 throw new Error('not implemented');
331 }
332 > mockDebug.ts
333 > get onDidProgressStart(): Event<DebugProtocol.ProgressStartEvent> {
334 throw new Error('not implemented');
335 }
336 > mockDebug.ts
337 > get onDidProgressUpdate(): Event<DebugProtocol.ProgressUpdateEvent> {
338 throw new Error('not implemented');
339 }
340 > mockDebug.ts
341 > get onDidProgressEnd(): Event<DebugProtocol.ProgressEndEvent> {
342 throw new Error('not implemented');
343 }
344 > mockDebug.ts
345 > setConfiguration(configuration: { resolved: IConfig; unresolved: IConfig }) { }
346 >
347 > getAllThreads(): IThread[] {
348 return [];
349 }
350 > mockDebug.ts
351 > getSource(raw: DebugProtocol.Source): Source {
352 throw new Error('not implemented');
353 }
354 > mockDebug.ts
355 > getLoadedSources(): Promise<Source[]> {
356 return Promise.resolve([]);
357 }
358 > mockDebug.ts
359 > completions(frameId: number, threadId: number, text: string, position: Position): Promise<DebugProtocol.CompletionsResponse> {
360 throw new Error('not implemented');
361 }
362 > mockDebug.ts
363 > clearThreads(removeThreads: boolean, reference?: number): void { }
364 >
365 > rawUpdate(data: IRawModelUpdate): void { }
366 >
367 > initialize(dbgr: IDebugger): Promise<void> {
368 throw new Error('Method not implemented.');
369 }
370 > launchOrAttach(config: IConfig): Promise<void> { mockDebug.ts
371 throw new Error('Method not implemented.');
372 }
373 > restart(): Promise<void> { mockDebug.ts
374 throw new Error('Method not implemented.');
375 }
376 > sendBreakpoints(modelUri: uri, bpts: IBreakpoint[], sourceModified: boolean): Promise<void> { mockDebug.ts
377 throw new Error('Method not implemented.');
378 }
379 > sendFunctionBreakpoints(fbps: IFunctionBreakpoint[]): Promise<void> { mockDebug.ts
380 throw new Error('Method not implemented.');
381 }
382 > sendExceptionBreakpoints(exbpts: IExceptionBreakpoint[]): Promise<void> { mockDebug.ts
383 throw new Error('Method not implemented.');
384 }
385 > sendInstructionBreakpoints(dbps: IInstructionBreakpoint[]): Promise<void> { mockDebug.ts
386 throw new Error('Method not implemented.');
387 }
388 > getDebugProtocolBreakpoint(breakpointId: string): DebugProtocol.Breakpoint | undefined { mockDebug.ts
389 throw new Error('Method not implemented.');
390 }
391 > customRequest(request: string, args: any): Promise<DebugProtocol.Response> { mockDebug.ts
392 throw new Error('Method not implemented.');
393 }
394 > stackTrace(threadId: number, startFrame: number, levels: number, token: CancellationToken): Promise<DebugProtocol.StackTraceResponse> { mockDebug.ts
395 throw new Error('Method not implemented.');
396 }
397 > exceptionInfo(threadId: number): Promise<IExceptionInfo> { mockDebug.ts
398 throw new Error('Method not implemented.');
399 }
400 > scopes(frameId: number): Promise<DebugProtocol.ScopesResponse> { mockDebug.ts
401 throw new Error('Method not implemented.');
402 }
403 > variables(variablesReference: number, threadId: number | undefined, filter: 'indexed' | 'named', start: number, count: number): Promise<DebugProtocol.VariablesResponse> { mockDebug.ts
404 throw new Error('Method not implemented.');
405 }
406 > evaluate(expression: string, frameId: number, context?: string): Promise<DebugProtocol.EvaluateResponse> { mockDebug.ts
407 throw new Error('Method not implemented.');
408 }
409 > restartFrame(frameId: number, threadId: number): Promise<void> { mockDebug.ts
410 throw new Error('Method not implemented.');
411 }
412 > next(threadId: number, granularity?: DebugProtocol.SteppingGranularity): Promise<void> { mockDebug.ts
413 throw new Error('Method not implemented.');
414 }
415 > stepIn(threadId: number, targetId?: number, granularity?: DebugProtocol.SteppingGranularity): Promise<void> { mockDebug.ts
416 throw new Error('Method not implemented.');
417 }
418 > stepOut(threadId: number, granularity?: DebugProtocol.SteppingGranularity): Promise<void> { mockDebug.ts
419 throw new Error('Method not implemented.');
420 }
421 > stepBack(threadId: number, granularity?: DebugProtocol.SteppingGranularity): Promise<void> { mockDebug.ts
422 throw new Error('Method not implemented.');
423 }
424 > continue(threadId: number): Promise<void> { mockDebug.ts
425 throw new Error('Method not implemented.');
426 }
427 > reverseContinue(threadId: number): Promise<void> { mockDebug.ts
428 throw new Error('Method not implemented.');
429 }
430 > pause(threadId: number): Promise<void> { mockDebug.ts
431 throw new Error('Method not implemented.');
432 }
433 > terminateThreads(threadIds: number[]): Promise<void> { mockDebug.ts
434 throw new Error('Method not implemented.');
435 }
436 > setVariable(variablesReference: number, name: string, value: string): Promise<DebugProtocol.SetVariableResponse> { mockDebug.ts
437 throw new Error('Method not implemented.');
438 }
439 > setExpression(frameId: number, expression: string, value: string): Promise<DebugProtocol.SetExpressionResponse | undefined> { mockDebug.ts
440 throw new Error('Method not implemented.');
441 }
442 > loadSource(resource: uri): Promise<DebugProtocol.SourceResponse> { mockDebug.ts
443 throw new Error('Method not implemented.');
444 }
445 > disassemble(memoryReference: string, offset: number, instructionOffset: number, instructionCount: number): Promise<DebugProtocol.DisassembledInstruction[] | undefined> { mockDebug.ts
446 throw new Error('Method not implemented.');
447 }
448 > mockDebug.ts
449 > terminate(restart = false): Promise<void> {
450 throw new Error('Method not implemented.');
451 }
452 > disconnect(restart = false): Promise<void> { mockDebug.ts
453 throw new Error('Method not implemented.');
454 }
455 > mockDebug.ts
456 > gotoTargets(source: DebugProtocol.Source, line: number, column?: number | undefined): Promise<DebugProtocol.GotoTargetsResponse> {
457 throw new Error('Method not implemented.');
458 }
459 > goto(threadId: number, targetId: number): Promise<DebugProtocol.GotoResponse> { mockDebug.ts
460 throw new Error('Method not implemented.');
461 }
462 > resolveLocationReference(locationReference: number): Promise<IDebugLocationReferenced> { mockDebug.ts
463 throw new Error('Method not implemented.');
464 }
465 > } mockDebug.ts
466 >
467 > export class MockRawSession {
468
469 capabilities: DebugProtocol.Capabilities = {};
597
598 readonly onDidStop: Event<DebugProtocol.StoppedEvent> = null!;
599 > } mockDebug.ts
600 >
601 > export class MockDebugAdapter extends AbstractDebugAdapter {
602 private seq = 0;
603
604 private pendingResponses = new Map<string, DeferredPromise<DebugProtocol.Response>>();
605 > mockDebug.ts
606 > startSession(): Promise<void> {
607 return Promise.resolve();
608 }
609 > mockDebug.ts
610 > stopSession(): Promise<void> {
611 return Promise.resolve();
612 }
613 > mockDebug.ts
614 > sendMessage(message: DebugProtocol.ProtocolMessage): void {
615 if (message.type === 'request') {
616 setTimeout(() => {
631 }
632 }
633 > mockDebug.ts
634 > sendResponseBody(request: DebugProtocol.Request, body: any) {
635 const response: DebugProtocol.Response = {
636 seq: ++this.seq,
643 this.acceptMessage(response);
644 }
645 > mockDebug.ts
646 > sendEventBody(event: string, body: any) {
647 const response: DebugProtocol.Event = {
648 seq: ++this.seq,
653 this.acceptMessage(response);
654 }
655 > mockDebug.ts
656 > waitForResponseFromClient(command: string): Promise<DebugProtocol.Response> {
657 const deferred = new DeferredPromise<DebugProtocol.Response>();
658 if (this.pendingResponses.has(command)) {
663 return deferred.p;
664 }
665 > mockDebug.ts
666 > sendRequestBody(command: string, args: any) {
667 const response: DebugProtocol.Request = {
668 seq: ++this.seq,
673 this.acceptMessage(response);
674 }
675 > mockDebug.ts
676 > evaluate(request: DebugProtocol.Request, args: DebugProtocol.EvaluateArguments) {
677 if (args.expression.indexOf('before.') === 0) {
678 this.sendEventBody('output', { output: args.expression });
688 }
689 }
690 > } mockDebug.ts
691 >
692 > export class MockDebugStorage extends DebugStorage {
693 >
694 > constructor(storageService: IStorageService) {
695 super(storageService, undefined!, undefined!, new NullLogService());
696 }
697 > } mockDebug.ts
src/vs/workbench/contrib/debug/common/debugStorage.ts 60 introduced LOC · 13 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- debugStorage.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { Disposable } from '../../../../base/common/lifecycle.js';
7 > import { ISettableObservable, observableValue } from '../../../../base/common/observable.js';
8 > import { URI } from '../../../../base/common/uri.js';
9 > import { ILogService } from '../../../../platform/log/common/log.js';
10 > import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
11 > import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
12 > import { IDebugModel, IEvaluate, IExpression } from './debug.js';
13 > import { Breakpoint, DataBreakpoint, ExceptionBreakpoint, Expression, FunctionBreakpoint } from './debugModel.js';
14 > import { ITextFileService } from '../../../services/textfile/common/textfiles.js';
15 > import { mapValues } from '../../../../base/common/objects.js';
16 >
17 > const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
18 > const DEBUG_FUNCTION_BREAKPOINTS_KEY = 'debug.functionbreakpoint';
19 > const DEBUG_DATA_BREAKPOINTS_KEY = 'debug.databreakpoint';
20 > const DEBUG_EXCEPTION_BREAKPOINTS_KEY = 'debug.exceptionbreakpoint';
21 > const DEBUG_WATCH_EXPRESSIONS_KEY = 'debug.watchexpressions';
22 > const DEBUG_CHOSEN_ENVIRONMENTS_KEY = 'debug.chosenenvironment';
23 > const DEBUG_UX_STATE_KEY = 'debug.uxstate';
24 >
25 > export interface IChosenEnvironment {
26 > type: string;
27 > dynamicLabel?: string;
28 > }
29 >
30 > export class DebugStorage extends Disposable {
31 > public readonly breakpoints: ISettableObservable<Breakpoint[]>;
32 > public readonly functionBreakpoints: ISettableObservable<FunctionBreakpoint[]>;
33 > public readonly exceptionBreakpoints: ISettableObservable<ExceptionBreakpoint[]>;
34 > public readonly dataBreakpoints: ISettableObservable<DataBreakpoint[]>;
35 > public readonly watchExpressions: ISettableObservable<Expression[]>;
36 >
37 > constructor(
38 @IStorageService private readonly storageService: IStorageService,
39 @ITextFileService private readonly textFileService: ITextFileService,
65 }));
66 }
68 > loadDebugUxState(): 'simple' | 'default' {
69 return this.storageService.get(DEBUG_UX_STATE_KEY, StorageScope.WORKSPACE, 'default') as 'simple' | 'default';
70 }
72 > storeDebugUxState(value: 'simple' | 'default'): void {
73 this.storageService.store(DEBUG_UX_STATE_KEY, value, StorageScope.WORKSPACE, StorageTarget.MACHINE);
74 }
76 > private loadBreakpoints(): Breakpoint[] {
77 let result: Breakpoint[] | undefined;
78 try {
87 return result || [];
88 }
90 > private loadFunctionBreakpoints(): FunctionBreakpoint[] {
91 let result: FunctionBreakpoint[] | undefined;
92 try {
100 return result || [];
101 }
103 > private loadExceptionBreakpoints(): ExceptionBreakpoint[] {
104 let result: ExceptionBreakpoint[] | undefined;
105 try {
113 return result || [];
114 }
116 > private loadDataBreakpoints(): DataBreakpoint[] {
117 let result: DataBreakpoint[] | undefined;
118 try {
126 return result || [];
127 }
129 > private loadWatchExpressions(): Expression[] {
130 let result: Expression[] | undefined;
131 try {
139 return result || [];
140 }
142 > loadChosenEnvironments(): Record<string, IChosenEnvironment> {
143 const obj = JSON.parse(this.storageService.get(DEBUG_CHOSEN_ENVIRONMENTS_KEY, StorageScope.WORKSPACE, '{}'));
144 // back compat from when this was a string map:
145 return mapValues(obj, (value): IChosenEnvironment => typeof value === 'string' ? { type: value } : value);
146 }
148 > storeChosenEnvironments(environments: Record<string, IChosenEnvironment>): void {
149 this.storageService.store(DEBUG_CHOSEN_ENVIRONMENTS_KEY, JSON.stringify(environments), StorageScope.WORKSPACE, StorageTarget.MACHINE);
150 }
152 > storeWatchExpressions(watchExpressions: (IExpression & IEvaluate)[]): void {
153 if (watchExpressions.length) {
154 this.storageService.store(DEBUG_WATCH_EXPRESSIONS_KEY, JSON.stringify(watchExpressions.map(we => ({ name: we.name, id: we.getId() }))), StorageScope.WORKSPACE, StorageTarget.MACHINE);
157 }
158 }
160 > storeBreakpoints(debugModel: IDebugModel): void {
161 const breakpoints = debugModel.getBreakpoints();
162 if (breakpoints.length) {
src/vs/workbench/contrib/debug/common/debugSource.ts 58 introduced LOC · 9 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- debugSource.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import * as nls from '../../../../nls.js';
7 > import { URI } from '../../../../base/common/uri.js';
8 > import { normalize, isAbsolute } from '../../../../base/common/path.js';
9 > import * as resources from '../../../../base/common/resources.js';
10 > import { DEBUG_SCHEME } from './debug.js';
11 > import { IRange } from '../../../../editor/common/core/range.js';
12 > import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from '../../../services/editor/common/editorService.js';
13 > import { Schemas } from '../../../../base/common/network.js';
14 > import { isUriString } from './debugUtils.js';
15 > import { IEditorPane } from '../../../common/editor.js';
16 > import { TextEditorSelectionRevealType } from '../../../../platform/editor/common/editor.js';
17 > import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
18 > import { ILogService } from '../../../../platform/log/common/log.js';
19 >
20 > export const UNKNOWN_SOURCE_LABEL = nls.localize('unknownSource', "Unknown Source");
21 >
22 > /**
23 > * Debug URI format
24 > *
25 > * a debug URI represents a Source object and the debug session where the Source comes from.
26 > *
27 > * debug:arbitrary_path?session=123e4567-e89b-12d3-a456-426655440000&ref=1016
28 > * \___/ \____________/ \__________________________________________/ \______/
29 > * | | | |
30 > * scheme source.path session id source.reference
31 > *
32 > *
33 > */
34 >
35 > export class Source {
36 >
37 > readonly uri: URI;
38 > available: boolean;
39 > raw: DebugProtocol.Source;
40 >
41 > constructor(raw_: DebugProtocol.Source | undefined, sessionId: string, uriIdentityService: IUriIdentityService, logService: ILogService) {
42 let path: string;
43 if (raw_) {
53 this.uri = getUriFromSource(this.raw, path, sessionId, uriIdentityService, logService);
54 }
56 > get name() {
57 return this.raw.name || resources.basenameOrAuthority(this.uri);
58 }
60 > get origin() {
61 return this.raw.origin;
62 }
64 > get presentationHint() {
65 return this.raw.presentationHint;
66 }
68 > get reference() {
69 return this.raw.sourceReference;
70 }
72 > get inMemory() {
73 return this.uri.scheme === DEBUG_SCHEME;
74 }
76 > openInEditor(editorService: IEditorService, selection: IRange, preserveFocus?: boolean, sideBySide?: boolean, pinned?: boolean): Promise<IEditorPane | undefined> {
77 return !this.available ? Promise.resolve(undefined) : editorService.openEditor({
78 resource: this.uri,
87 }, sideBySide ? SIDE_GROUP : ACTIVE_GROUP);
88 }
90 > static getEncodedDebugData(modelUri: URI): { name: string; path: string; sessionId?: string; sourceReference?: number } {
91 let path: string;
92 let sourceReference: number | undefined;
128 };
129 }
130 > } debugSource.ts
131 >
132 > export function getUriFromSource(raw: DebugProtocol.Source, path: string | undefined, sessionId: string, uriIdentityService: IUriIdentityService, logService: ILogService): URI {
133 const _getUriFromSource = (path: string | undefined) => {
134 if (typeof raw.sourceReference === 'number' && raw.sourceReference > 0) {
src/vs/workbench/contrib/debug/common/disassemblyViewInput.ts 22 introduced LOC · 5 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- disassemblyViewInput.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { EditorInput } from '../../../common/editor/editorInput.js';
7 > import { localize } from '../../../../nls.js';
8 > import { ThemeIcon } from '../../../../base/common/themables.js';
9 > import { Codicon } from '../../../../base/common/codicons.js';
10 > import { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';
11 >
12 > const DisassemblyEditorIcon = registerIcon('disassembly-editor-label-icon', Codicon.debug, localize('disassemblyEditorLabelIcon', 'Icon of the disassembly editor label.'));
13 >
14 > export class DisassemblyViewInput extends EditorInput {
15
16 static readonly ID = 'debug.disassemblyView.input';