提交 cfff1af9 编写于 作者: I isidor

remove debugService.findProcessByUUID, there are alternative ways to do this

上级 2575c108
......@@ -37,8 +37,10 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
}));
this._toDispose.push(debugService.onDidCustomEvent(event => {
if (event && event.sessionId) {
const process = this.debugService.findProcessByUUID(event.sessionId);
this._proxy.$acceptDebugSessionCustomEvent(event.sessionId, process.configuration.type, process.configuration.name, event);
const process = this.debugService.getModel().getProcesses().filter(p => p.getId() === event.sessionId).pop();
if (process) {
this._proxy.$acceptDebugSessionCustomEvent(event.sessionId, process.configuration.type, process.configuration.name, event);
}
}
}));
}
......@@ -82,7 +84,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
}
public $customDebugAdapterRequest(sessionId: DebugSessionUUID, request: string, args: any): TPromise<any> {
const process = this.debugService.findProcessByUUID(sessionId);
const process = this.debugService.getModel().getProcesses().filter(p => p.getId() === sessionId).pop();
if (process) {
return process.session.custom(request, args).then(response => {
if (response.success) {
......
......@@ -54,7 +54,8 @@ export class DebugContentProvider implements IWorkbenchContribution, ITextModelC
if (pair.length === 2) {
switch (pair[0]) {
case 'session':
process = this.debugService.findProcessByUUID(decodeURIComponent(pair[1]));
const processId = decodeURIComponent(pair[1]);
process = this.debugService.getModel().getProcesses().filter(p => p.getId() === processId).pop();
break;
case 'ref':
sourceRef = parseInt(pair[1]);
......
......@@ -591,11 +591,6 @@ export interface IDebugService {
*/
startDebugging(root: IWorkspaceFolder, configOrName?: IConfig | string, noDebug?: boolean): TPromise<any>;
/**
* Find process by ID.
*/
findProcessByUUID(uuid: string): IProcess | null;
/**
* Restarts a process or creates a new one if there is no active session.
*/
......
......@@ -726,15 +726,6 @@ export class DebugService implements debug.IDebugService {
)));
}
public findProcessByUUID(uuid: string): debug.IProcess | null {
const processes = this.getModel().getProcesses();
const result = processes.filter(process => process.getId() === uuid);
if (result.length > 0) {
return result[0]; // there can only be one
}
return null;
}
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 => {
......
......@@ -92,10 +92,6 @@ export class MockDebugService implements debug.IDebugService {
return TPromise.as(null);
}
public findProcessByUUID(uuid: string): debug.IProcess | null {
return null;
}
public restartProcess(): TPromise<any> {
return TPromise.as(null);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册