提交 2775e756 编写于 作者: I isidor

debug: get into initilizing state immediatly

fixes #36044
fixes #45798
上级 c1fb394d
......@@ -628,7 +628,7 @@ export interface IDebugService {
* Also saves all files, manages if compounds are present in the configuration
* and resolveds configurations via DebugConfigurationProviders.
*/
startDebugging(launch: ILaunch, configOrName?: IConfig | string, noDebug?: boolean): TPromise<any>;
startDebugging(launch: ILaunch, configOrName?: IConfig | string, noDebug?: boolean): TPromise<void>;
/**
* Restarts a process or creates a new one if there is no active session.
......
......@@ -681,7 +681,14 @@ export class DebugService implements debug.IDebugService {
this.model.removeWatchExpressions(id);
}
public startDebugging(launch: debug.ILaunch, configOrName?: debug.IConfig | string, noDebug = false): TPromise<any> {
public startDebugging(launch: debug.ILaunch, configOrName?: debug.IConfig | string, noDebug = false): TPromise<void> {
const sessionId = generateUuid();
this.updateStateAndEmit(sessionId, debug.State.Initializing);
const wrapUpState = () => {
if (this.sessionStates.get(sessionId) === debug.State.Initializing) {
this.updateStateAndEmit(sessionId, debug.State.Inactive);
}
};
// make sure to save all files and that the configuration is up to date
return this.extensionService.activateByEvent('onDebug').then(() => this.textFileService.saveAll().then(() => this.configurationService.reloadConfiguration(launch ? launch.workspace : undefined).then(() =>
......@@ -759,14 +766,6 @@ export class DebugService implements debug.IDebugService {
config.noDebug = true;
}
const sessionId = generateUuid();
this.updateStateAndEmit(sessionId, debug.State.Initializing);
const wrapUpState = () => {
if (this.sessionStates.get(sessionId) === debug.State.Initializing) {
this.updateStateAndEmit(sessionId, debug.State.Inactive);
}
};
return (type ? TPromise.as(null) : this.configurationManager.guessAdapter().then(a => type = a && a.type)).then(() =>
(type ? this.extensionService.activateByEvent(`onDebugResolve:${type}`) : TPromise.as(null)).then(() =>
this.configurationManager.resolveConfigurationByProviders(launch && launch.workspace ? launch.workspace.uri : undefined, type, config).then(config => {
......@@ -779,12 +778,12 @@ export class DebugService implements debug.IDebugService {
return launch.openConfigFile(false, type).done(undefined, errors.onUnexpectedError);
}
})
).then(() => wrapUpState(), err => {
wrapUpState();
return <any>TPromise.wrapError(err);
}));
)).then(() => undefined);
})
)));
))).then(() => wrapUpState(), err => {
wrapUpState();
return TPromise.wrapError(err);
});
}
private createProcess(launch: debug.ILaunch, config: debug.IConfig, sessionId: string): TPromise<void> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册