提交 55643dd7 编写于 作者: I isidor

debug: make createProcess private and remove startDebugSession from exHostDebugService

fixes #36132
上级 0cd0f70b
......@@ -80,22 +80,6 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
});
}
public $startDebugSession(folderUri: uri | undefined, configuration: IConfig): TPromise<DebugSessionUUID> {
if (configuration.request !== 'launch' && configuration.request !== 'attach') {
return TPromise.wrapError(new Error(`only 'launch' or 'attach' allowed for 'request' attribute`));
}
const folder = folderUri ? this.contextService.getWorkspace().folders.filter(wf => wf.uri.toString() === folderUri.toString()).pop() : undefined;
return this.debugService.createProcess(folder, configuration).then(process => {
if (process) {
return <DebugSessionUUID>process.getId();
}
return TPromise.wrapError<DebugSessionUUID>(new Error('cannot create debug session'));
}, err => {
return TPromise.wrapError(err && err.message ? err.message : 'cannot start debug session');
});
}
public $customDebugAdapterRequest(sessionId: DebugSessionUUID, request: string, args: any): TPromise<any> {
const process = this.debugService.findProcessByUUID(sessionId);
if (process) {
......
......@@ -393,7 +393,6 @@ export interface MainThreadDebugServiceShape extends IDisposable {
$registerDebugConfigurationProvider(type: string, hasProvideMethod: boolean, hasResolveMethod: boolean, handle: number): TPromise<any>;
$unregisterDebugConfigurationProvider(handle: number): TPromise<any>;
$startDebugging(folder: URI | undefined, nameOrConfig: string | vscode.DebugConfiguration): TPromise<boolean>;
$startDebugSession(folder: URI | undefined, config: vscode.DebugConfiguration): TPromise<DebugSessionUUID>;
$customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): TPromise<any>;
}
......
......@@ -98,14 +98,6 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
return this._debugServiceProxy.$startDebugging(folder ? folder.uri : undefined, nameOrConfig);
}
public startDebugSession(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration): TPromise<vscode.DebugSession> {
return this._debugServiceProxy.$startDebugSession(folder ? folder.uri : undefined, config).then((id: DebugSessionUUID) => {
const debugSession = new ExtHostDebugSession(this._debugServiceProxy, id, config.type, config.name);
this._debugSessions.set(id, debugSession);
return debugSession;
});
}
public $acceptDebugSessionStarted(id: DebugSessionUUID, type: string, name: string): void {
let debugSession = this._debugSessions.get(id);
......
......@@ -591,11 +591,6 @@ export interface IDebugService {
*/
startDebugging(root: IWorkspaceFolder, configOrName?: IConfig | string, noDebug?: boolean): TPromise<any>;
/**
* Creates a new debug process. Depending on the configuration will either 'launch' or 'attach'.
*/
createProcess(root: IWorkspaceFolder, config: IConfig): TPromise<IProcess>;
/**
* Find process by ID.
*/
......
......@@ -727,7 +727,7 @@ export class DebugService implements debug.IDebugService {
return null;
}
public createProcess(root: IWorkspaceFolder, config: debug.IConfig, sessionId?: string): TPromise<debug.IProcess> {
private createProcess(root: IWorkspaceFolder, config: debug.IConfig, sessionId: string): TPromise<debug.IProcess> {
return this.textFileService.saveAll().then(() =>
(this.configurationManager.selectedLaunch ? this.configurationManager.selectedLaunch.resolveConfiguration(config) : TPromise.as(config)).then(resolvedConfig => {
if (!resolvedConfig) {
......@@ -749,11 +749,6 @@ export class DebugService implements debug.IDebugService {
return TPromise.wrapError(errors.create(message, { actions: [this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL), CloseAction] }));
}
if (!sessionId) {
sessionId = generateUuid();
this.updateStateAndEmit(sessionId, debug.State.Initializing);
}
return this.runPreLaunchTask(root, resolvedConfig.preLaunchTask).then((taskSummary: ITaskSummary) => {
const errorCount = resolvedConfig.preLaunchTask ? this.markerService.getStatistics().errors : 0;
const successExitCode = taskSummary && taskSummary.exitCode === 0;
......@@ -1003,7 +998,7 @@ export class DebugService implements debug.IDebugService {
config.noDebug = process.configuration.noDebug;
}
config.__restart = restartData;
this.createProcess(process.session.root, config).then(() => c(null), err => e(err));
this.createProcess(process.session.root, config, process.getId()).then(() => c(null), err => e(err));
}, 300);
});
}).then(() => {
......
......@@ -92,10 +92,6 @@ export class MockDebugService implements debug.IDebugService {
return TPromise.as(null);
}
public createProcess(root: IWorkspaceFolder, config: debug.IConfig): TPromise<any> {
return TPromise.as(null);
}
public findProcessByUUID(uuid: string): debug.IProcess | null {
return null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册