This commit is contained in:
isidor 2021-08-04 20:28:25 +02:00
parent 469640333f
commit 8d87bdf345
No known key found for this signature in database
GPG key ID: F9280366A8370105
3 changed files with 10 additions and 4 deletions

View file

@ -537,6 +537,14 @@ export class DebugService implements IDebugService {
private async doCreateSession(sessionId: string, root: IWorkspaceFolder | undefined, configuration: { resolved: IConfig, unresolved: IConfig | undefined }, options?: IDebugSessionOptions): Promise<boolean> {
const session = this.instantiationService.createInstance(DebugSession, sessionId, configuration, root, this.model, options);
if (this.model.getSessions().some(s => s.getLabel() === session.getLabel())) {
// There is already a session with the same name, prompt user #127721
const result = await this.dialogService.confirm({ message: nls.localize('multipleSession', "'{0}' is already running. Are you sure you want to start it again?", session.getLabel()) });
if (!result.confirmed) {
return false;
}
}
this.model.addSession(session);
// register listeners as the very first thing!
this.registerSessionListeners(session);

View file

@ -36,7 +36,6 @@ import { filterExceptionsFromTelemetry } from 'vs/workbench/contrib/debug/common
import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot';
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
export class DebugSession implements IDebugSession {
@ -86,7 +85,6 @@ export class DebugSession implements IDebugSession {
@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ICustomEndpointTelemetryService private readonly customEndpointTelemetryService: ICustomEndpointTelemetryService,
@IContextKeyService contextKeyService: IContextKeyService
) {
this._options = options || {};
if (this.hasSeparateRepl()) {

View file

@ -38,7 +38,7 @@ export function createMockSession(model: DebugModel, name = 'mockSession', optio
}
};
}
} as IDebugService, undefined!, undefined!, new TestConfigurationService({ debug: { console: { collapseIdenticalLines: true } } }), undefined!, mockWorkspaceContextService, undefined!, undefined!, undefined!, mockUriIdentityService, new TestInstantiationService(), undefined!, undefined!);
} as IDebugService, undefined!, undefined!, new TestConfigurationService({ debug: { console: { collapseIdenticalLines: true } } }), undefined!, mockWorkspaceContextService, undefined!, undefined!, undefined!, mockUriIdentityService, new TestInstantiationService(), undefined!);
}
function createTwoStackFrames(session: DebugSession): { firstStackFrame: StackFrame, secondStackFrame: StackFrame } {
@ -378,7 +378,7 @@ suite('Debug - CallStack', () => {
override get state(): State {
return State.Stopped;
}
}(generateUuid(), { resolved: { name: 'stoppedSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, mockWorkspaceContextService, undefined!, undefined!, undefined!, mockUriIdentityService, new TestInstantiationService(), undefined!, undefined!);
}(generateUuid(), { resolved: { name: 'stoppedSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined!, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, mockWorkspaceContextService, undefined!, undefined!, undefined!, mockUriIdentityService, new TestInstantiationService(), undefined!);
const runningSession = createMockSession(model);
model.addSession(runningSession);