@@ -83,7 +83,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
83
83
get onDidChangeActiveDebugSession ( ) : Event < vscode . DebugSession | undefined > { return this . _onDidChangeActiveDebugSession . event ; }
84
84
85
85
private _activeDebugSession : ExtHostDebugSession | undefined ;
86
- get activeDebugSession ( ) : ExtHostDebugSession | undefined { return this . _activeDebugSession ; }
86
+ get activeDebugSession ( ) : vscode . DebugSession | undefined { return this . _activeDebugSession ?. api ; }
87
87
88
88
private readonly _onDidReceiveDebugSessionCustomEvent : Emitter < vscode . DebugSessionCustomEvent > ;
89
89
get onDidReceiveDebugSessionCustomEvent ( ) : Event < vscode . DebugSessionCustomEvent > { return this . _onDidReceiveDebugSessionCustomEvent . event ; }
@@ -258,7 +258,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
258
258
}
259
259
260
260
const visualizations = await provider . provideDebugVisualization ( {
261
- session,
261
+ session : session . api ,
262
262
variable : context . variable ,
263
263
containerId : context . containerId ,
264
264
frameId : context . frameId ,
@@ -691,9 +691,9 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
691
691
}
692
692
693
693
if ( focusDto . kind === 'thread' ) {
694
- focus = new ThreadFocus ( session , focusDto . threadId ) ;
694
+ focus = new ThreadFocus ( session . api , focusDto . threadId ) ;
695
695
} else {
696
- focus = new StackFrameFocus ( session , focusDto . threadId , focusDto . frameId ) ;
696
+ focus = new StackFrameFocus ( session . api , focusDto . threadId , focusDto . frameId ) ;
697
697
}
698
698
699
699
this . _stackFrameFocus = < vscode . ThreadFocus | vscode . StackFrameFocus > focus ;
@@ -763,20 +763,20 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
763
763
764
764
public async $acceptDebugSessionStarted ( sessionDto : IDebugSessionDto ) : Promise < void > {
765
765
const session = await this . getSession ( sessionDto ) ;
766
- this . _onDidStartDebugSession . fire ( session ) ;
766
+ this . _onDidStartDebugSession . fire ( session . api ) ;
767
767
}
768
768
769
769
public async $acceptDebugSessionTerminated ( sessionDto : IDebugSessionDto ) : Promise < void > {
770
770
const session = await this . getSession ( sessionDto ) ;
771
771
if ( session ) {
772
- this . _onDidTerminateDebugSession . fire ( session ) ;
772
+ this . _onDidTerminateDebugSession . fire ( session . api ) ;
773
773
this . _debugSessions . delete ( session . id ) ;
774
774
}
775
775
}
776
776
777
777
public async $acceptDebugSessionActiveChanged ( sessionDto : IDebugSessionDto | undefined ) : Promise < void > {
778
778
this . _activeDebugSession = sessionDto ? await this . getSession ( sessionDto ) : undefined ;
779
- this . _onDidChangeActiveDebugSession . fire ( this . _activeDebugSession ) ;
779
+ this . _onDidChangeActiveDebugSession . fire ( this . _activeDebugSession ?. api ) ;
780
780
}
781
781
782
782
public async $acceptDebugSessionNameChanged ( sessionDto : IDebugSessionDto , name : string ) : Promise < void > {
@@ -787,7 +787,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
787
787
public async $acceptDebugSessionCustomEvent ( sessionDto : IDebugSessionDto , event : any ) : Promise < void > {
788
788
const session = await this . getSession ( sessionDto ) ;
789
789
const ee : vscode . DebugSessionCustomEvent = {
790
- session : session ,
790
+ session : session . api ,
791
791
event : event . event ,
792
792
body : event . body
793
793
} ;
@@ -874,7 +874,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
874
874
875
875
const promises = this . _trackerFactories
876
876
. 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 ) ) ;
878
878
879
879
return Promise . race ( [
880
880
Promise . all ( promises ) . then ( result => {
@@ -901,7 +901,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
901
901
902
902
if ( adapterDescriptorFactory ) {
903
903
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 => {
905
905
if ( daDescriptor ) {
906
906
return daDescriptor ;
907
907
}
@@ -940,7 +940,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
940
940
if ( ! ds ) {
941
941
const folder = await this . getFolder ( dto . folderUri ) ;
942
942
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 ) ;
944
944
this . _debugSessions . set ( ds . id , ds ) ;
945
945
this . _debugServiceProxy . $sessionCached ( ds . id ) ;
946
946
}
@@ -1003,7 +1003,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
1003
1003
}
1004
1004
}
1005
1005
1006
- export class ExtHostDebugSession implements vscode . DebugSession {
1006
+ export class ExtHostDebugSession {
1007
1007
1008
1008
constructor (
1009
1009
private _debugServiceProxy : MainThreadDebugServiceShape ,
@@ -1015,6 +1015,30 @@ export class ExtHostDebugSession implements vscode.DebugSession {
1015
1015
private _parentSession : vscode . DebugSession | undefined ) {
1016
1016
}
1017
1017
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
+
1018
1042
public get id ( ) : string {
1019
1043
return this . _id ;
1020
1044
}
@@ -1023,37 +1047,13 @@ export class ExtHostDebugSession implements vscode.DebugSession {
1023
1047
return this . _type ;
1024
1048
}
1025
1049
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
-
1038
1050
_acceptNameChanged ( name : string ) {
1039
1051
this . _name = name ;
1040
1052
}
1041
1053
1042
- public get workspaceFolder ( ) : vscode . WorkspaceFolder | undefined {
1043
- return this . _workspaceFolder ;
1044
- }
1045
-
1046
1054
public get configuration ( ) : vscode . DebugConfiguration {
1047
1055
return this . _configuration ;
1048
1056
}
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
- }
1057
1057
}
1058
1058
1059
1059
export class ExtHostDebugConsole {
0 commit comments