提交 ce5ee6e7 编写于 作者: A Andre Weinand

support both startSessionCommand and resolveDebugConfiguration

上级 cf95ccce
......@@ -657,47 +657,50 @@ export class DebugService implements debug.IDebugService {
}
return manager.getStartSessionCommand(config ? config.type : undefined).then<any>(commandAndType => {
if (noDebug && config) {
config.noDebug = true;
}
// deprecated code: use DebugConfigurationProvider instead of startSessionCommand
if (commandAndType && commandAndType.command) {
const defaultConfig = noDebug ? { noDebug: true } : {};
return this.commandService.executeCommand(commandAndType.command, config || defaultConfig, launch ? launch.workspaceUri : undefined).then((result: StartSessionResult) => {
if (launch) {
if (result && result.status === 'initialConfiguration') {
return launch.openConfigFile(false, commandAndType.type);
}
if (result && result.status === 'saveConfiguration') {
return this.fileService.updateContent(launch.uri, result.content).then(() => launch.openConfigFile(false));
}
}
return undefined;
});
if (!config) {
// no-folder workspace
config = <debug.IConfig>{};
if (commandAndType && commandAndType.type) {
config.type = commandAndType.type;
}
}
// end of deprecation
if (!config && commandAndType.type) {
config = {
type: commandAndType.type,
request: 'launch'
};
if (noDebug) {
config.noDebug = true;
}
if (config) {
return this.configurationManager.resolveDebugConfiguration(launch ? launch.workspaceUri : undefined, config).then(config => {
return this.configurationManager.resolveDebugConfiguration(launch ? launch.workspaceUri : undefined, config).then(config => {
// deprecated code: use DebugConfigurationProvider instead of startSessionCommand
if (commandAndType && commandAndType.command) {
const defaultConfig = noDebug ? { noDebug: true } : {};
return this.commandService.executeCommand(commandAndType.command, config || defaultConfig, launch ? launch.workspaceUri : undefined).then((result: StartSessionResult) => {
if (launch) {
if (result && result.status === 'initialConfiguration') {
return launch.openConfigFile(false, commandAndType.type);
}
if (result && result.status === 'saveConfiguration') {
return this.fileService.updateContent(launch.uri, result.content).then(() => launch.openConfigFile(false));
}
}
return <TPromise>undefined;
});
}
// end of deprecation
if (config.type) {
// TODO@AW: handle the 'initialConfiguration' and 'saveConfiguration' cases from above!
return this.createProcess(root, config);
});
}
if (launch && commandAndType) {
return launch.openConfigFile(false, commandAndType.type);
}
}
return undefined;
if (launch && commandAndType) {
return launch.openConfigFile(false, commandAndType.type);
}
return undefined;
});
});
})
));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册