Skip to content

Commit b637950

Browse files
authored
Reenable debug integration test (microsoft#203733)
1 parent 0f32344 commit b637950

File tree

4 files changed

+43
-41
lines changed

4 files changed

+43
-41
lines changed

extensions/vscode-api-tests/src/singlefolder-tests/debug.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ suite('vscode API - debug', function () {
4949
disposeAll(toDispose);
5050
});
5151

52-
test.skip('start debugging', async function () {
52+
test('start debugging', async function () {
5353
let stoppedEvents = 0;
5454
let variablesReceived: () => void;
5555
let initializedReceived: () => void;

extensions/vscode-api-tests/testWorkspace/.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"type": "pwa-node",
8+
"type": "node",
99
"request": "launch",
1010
"name": "Launch debug.js",
1111
"stopOnEntry": true,

extensions/vscode-api-tests/testWorkspace/debug.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
let y = 0;
7-
for (let i = 0; i < 100; i++) {
8-
console.log(y);
9-
y = y + i;
7+
let z = 1;
8+
hello();
9+
10+
function hello() {
11+
console.log('hello');
1012
}

src/vs/workbench/api/common/extHostDebugService.ts

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
8383
get onDidChangeActiveDebugSession(): Event<vscode.DebugSession | undefined> { return this._onDidChangeActiveDebugSession.event; }
8484

8585
private _activeDebugSession: ExtHostDebugSession | undefined;
86-
get activeDebugSession(): ExtHostDebugSession | undefined { return this._activeDebugSession; }
86+
get activeDebugSession(): vscode.DebugSession | undefined { return this._activeDebugSession?.api; }
8787

8888
private readonly _onDidReceiveDebugSessionCustomEvent: Emitter<vscode.DebugSessionCustomEvent>;
8989
get onDidReceiveDebugSessionCustomEvent(): Event<vscode.DebugSessionCustomEvent> { return this._onDidReceiveDebugSessionCustomEvent.event; }
@@ -258,7 +258,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
258258
}
259259

260260
const visualizations = await provider.provideDebugVisualization({
261-
session,
261+
session: session.api,
262262
variable: context.variable,
263263
containerId: context.containerId,
264264
frameId: context.frameId,
@@ -691,9 +691,9 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
691691
}
692692

693693
if (focusDto.kind === 'thread') {
694-
focus = new ThreadFocus(session, focusDto.threadId);
694+
focus = new ThreadFocus(session.api, focusDto.threadId);
695695
} else {
696-
focus = new StackFrameFocus(session, focusDto.threadId, focusDto.frameId);
696+
focus = new StackFrameFocus(session.api, focusDto.threadId, focusDto.frameId);
697697
}
698698

699699
this._stackFrameFocus = <vscode.ThreadFocus | vscode.StackFrameFocus>focus;
@@ -763,20 +763,20 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
763763

764764
public async $acceptDebugSessionStarted(sessionDto: IDebugSessionDto): Promise<void> {
765765
const session = await this.getSession(sessionDto);
766-
this._onDidStartDebugSession.fire(session);
766+
this._onDidStartDebugSession.fire(session.api);
767767
}
768768

769769
public async $acceptDebugSessionTerminated(sessionDto: IDebugSessionDto): Promise<void> {
770770
const session = await this.getSession(sessionDto);
771771
if (session) {
772-
this._onDidTerminateDebugSession.fire(session);
772+
this._onDidTerminateDebugSession.fire(session.api);
773773
this._debugSessions.delete(session.id);
774774
}
775775
}
776776

777777
public async $acceptDebugSessionActiveChanged(sessionDto: IDebugSessionDto | undefined): Promise<void> {
778778
this._activeDebugSession = sessionDto ? await this.getSession(sessionDto) : undefined;
779-
this._onDidChangeActiveDebugSession.fire(this._activeDebugSession);
779+
this._onDidChangeActiveDebugSession.fire(this._activeDebugSession?.api);
780780
}
781781

782782
public async $acceptDebugSessionNameChanged(sessionDto: IDebugSessionDto, name: string): Promise<void> {
@@ -787,7 +787,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
787787
public async $acceptDebugSessionCustomEvent(sessionDto: IDebugSessionDto, event: any): Promise<void> {
788788
const session = await this.getSession(sessionDto);
789789
const ee: vscode.DebugSessionCustomEvent = {
790-
session: session,
790+
session: session.api,
791791
event: event.event,
792792
body: event.body
793793
};
@@ -874,7 +874,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
874874

875875
const promises = this._trackerFactories
876876
.filter(tuple => tuple.type === type || tuple.type === '*')
877-
.map(tuple => asPromise<vscode.ProviderResult<vscode.DebugAdapterTracker>>(() => tuple.factory.createDebugAdapterTracker(session)).then(p => p, err => null));
877+
.map(tuple => asPromise<vscode.ProviderResult<vscode.DebugAdapterTracker>>(() => tuple.factory.createDebugAdapterTracker(session.api)).then(p => p, err => null));
878878

879879
return Promise.race([
880880
Promise.all(promises).then(result => {
@@ -901,7 +901,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
901901

902902
if (adapterDescriptorFactory) {
903903
const extensionRegistry = await this._extensionService.getExtensionRegistry();
904-
return asPromise(() => adapterDescriptorFactory.createDebugAdapterDescriptor(session, this.daExecutableFromPackage(session, extensionRegistry))).then(daDescriptor => {
904+
return asPromise(() => adapterDescriptorFactory.createDebugAdapterDescriptor(session.api, this.daExecutableFromPackage(session, extensionRegistry))).then(daDescriptor => {
905905
if (daDescriptor) {
906906
return daDescriptor;
907907
}
@@ -940,7 +940,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
940940
if (!ds) {
941941
const folder = await this.getFolder(dto.folderUri);
942942
const parent = dto.parent ? this._debugSessions.get(dto.parent) : undefined;
943-
ds = new ExtHostDebugSession(this._debugServiceProxy, dto.id, dto.type, dto.name, folder, dto.configuration, parent);
943+
ds = new ExtHostDebugSession(this._debugServiceProxy, dto.id, dto.type, dto.name, folder, dto.configuration, parent?.api);
944944
this._debugSessions.set(ds.id, ds);
945945
this._debugServiceProxy.$sessionCached(ds.id);
946946
}
@@ -1003,7 +1003,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
10031003
}
10041004
}
10051005

1006-
export class ExtHostDebugSession implements vscode.DebugSession {
1006+
export class ExtHostDebugSession {
10071007

10081008
constructor(
10091009
private _debugServiceProxy: MainThreadDebugServiceShape,
@@ -1015,6 +1015,30 @@ export class ExtHostDebugSession implements vscode.DebugSession {
10151015
private _parentSession: vscode.DebugSession | undefined) {
10161016
}
10171017

1018+
public get api(): vscode.DebugSession {
1019+
const that = this;
1020+
return Object.freeze({
1021+
id: that._id,
1022+
type: that._type,
1023+
get name() {
1024+
return that._name;
1025+
},
1026+
set name(name: string) {
1027+
that._name = name;
1028+
that._debugServiceProxy.$setDebugSessionName(that._id, name);
1029+
},
1030+
parentSession: that._parentSession,
1031+
workspaceFolder: that._workspaceFolder,
1032+
configuration: that._configuration,
1033+
customRequest(command: string, args: any): Promise<any> {
1034+
return that._debugServiceProxy.$customDebugAdapterRequest(that._id, command, args);
1035+
},
1036+
getDebugProtocolBreakpoint(breakpoint: vscode.Breakpoint): Promise<vscode.DebugProtocolBreakpoint | undefined> {
1037+
return that._debugServiceProxy.$getDebugProtocolBreakpoint(that._id, breakpoint.id);
1038+
}
1039+
});
1040+
}
1041+
10181042
public get id(): string {
10191043
return this._id;
10201044
}
@@ -1023,37 +1047,13 @@ export class ExtHostDebugSession implements vscode.DebugSession {
10231047
return this._type;
10241048
}
10251049

1026-
public get name(): string {
1027-
return this._name;
1028-
}
1029-
public set name(name: string) {
1030-
this._name = name;
1031-
this._debugServiceProxy.$setDebugSessionName(this._id, name);
1032-
}
1033-
1034-
public get parentSession(): vscode.DebugSession | undefined {
1035-
return this._parentSession;
1036-
}
1037-
10381050
_acceptNameChanged(name: string) {
10391051
this._name = name;
10401052
}
10411053

1042-
public get workspaceFolder(): vscode.WorkspaceFolder | undefined {
1043-
return this._workspaceFolder;
1044-
}
1045-
10461054
public get configuration(): vscode.DebugConfiguration {
10471055
return this._configuration;
10481056
}
1049-
1050-
public customRequest(command: string, args: any): Promise<any> {
1051-
return this._debugServiceProxy.$customDebugAdapterRequest(this._id, command, args);
1052-
}
1053-
1054-
public getDebugProtocolBreakpoint(breakpoint: vscode.Breakpoint): Promise<vscode.DebugProtocolBreakpoint | undefined> {
1055-
return this._debugServiceProxy.$getDebugProtocolBreakpoint(this._id, breakpoint.id);
1056-
}
10571057
}
10581058

10591059
export class ExtHostDebugConsole {

0 commit comments

Comments
 (0)