@@ -16,9 +16,8 @@ import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
1616import { INotificationService } from 'vs/platform/notification/common/notification' ;
1717import { formatPII } from 'vs/workbench/parts/debug/common/debugUtils' ;
1818import { SocketDebugAdapter } from 'vs/workbench/parts/debug/node/debugAdapter' ;
19- import { DebugEvent , IRawSession , IDebugAdapter , IConfig } from 'vs/workbench/parts/debug/common/debug' ;
19+ import { DebugEvent , IRawSession , IDebugAdapter } from 'vs/workbench/parts/debug/common/debug' ;
2020import { CancellationToken , CancellationTokenSource } from 'vs/base/common/cancellation' ;
21- import { equalsIgnoreCase } from 'vs/base/common/strings' ;
2221
2322export interface SessionExitedEvent extends DebugEvent {
2423 body : {
@@ -48,8 +47,7 @@ export class RawDebugSession implements IRawSession {
4847 private cancellationTokens : CancellationTokenSource [ ] ;
4948 private _capabilities : DebugProtocol . Capabilities ;
5049 private allThreadsContinued : boolean ;
51- private debugServerPort : number ;
52- private isAttach : boolean ;
50+ private isAttached : boolean ;
5351
5452 private readonly _onDidInitialize : Emitter < DebugProtocol . InitializedEvent > ;
5553 private readonly _onDidStop : Emitter < DebugProtocol . StoppedEvent > ;
@@ -66,7 +64,7 @@ export class RawDebugSession implements IRawSession {
6664
6765 constructor (
6866 private sessionId : string ,
69- configuration : IConfig ,
67+ private debugServerPort : number ,
7068 private _debugger : Debugger ,
7169 public customTelemetryService : ITelemetryService ,
7270 private root : IWorkspaceFolder ,
@@ -78,8 +76,6 @@ export class RawDebugSession implements IRawSession {
7876 this . readyForBreakpoints = false ;
7977 this . allThreadsContinued = true ;
8078 this . cancellationTokens = [ ] ;
81- this . debugServerPort = configuration . debugServer ;
82- this . isAttach = configuration . request === 'attach' || equalsIgnoreCase ( configuration . type , 'extensionHost' ) ;
8379
8480 this . _onDidInitialize = new Emitter < DebugProtocol . InitializedEvent > ( ) ;
8581 this . _onDidStop = new Emitter < DebugProtocol . StoppedEvent > ( ) ;
@@ -292,6 +288,7 @@ export class RawDebugSession implements IRawSession {
292288 }
293289
294290 public attach ( args : DebugProtocol . AttachRequestArguments ) : TPromise < DebugProtocol . AttachResponse > {
291+ this . isAttached = true ;
295292 return this . send ( 'attach' , args ) . then ( response => this . readCapabilities ( response ) ) ;
296293 }
297294
@@ -350,7 +347,7 @@ export class RawDebugSession implements IRawSession {
350347 }
351348
352349 public terminate ( restart = false ) : TPromise < DebugProtocol . TerminateResponse > {
353- if ( this . capabilities . supportsTerminateRequest && ! this . terminated && ! this . isAttach ) {
350+ if ( this . capabilities . supportsTerminateRequest && ! this . terminated && ! this . isAttached ) {
354351 this . terminated = true ;
355352 return this . send ( 'terminate' , { restart } ) ;
356353 }
0 commit comments