Revert "If there is only one adapter with an initial configuration automatically pick it to simplify debug setup"

This reverts commit ac0856ef50.
This commit is contained in:
isidor
2017-01-10 15:14:19 +01:00
parent 1bdcec342b
commit 8d6540f92c
2 changed files with 36 additions and 43 deletions
@@ -332,50 +332,47 @@ export class ConfigurationManager implements debug.IConfigurationManager {
const resource = uri.file(paths.join(this.contextService.getWorkspace().resource.fsPath, '/.vscode/launch.json'));
let configFileCreated = false;
return this.fileService.resolveContent(resource).then(content => true, err => {
const adapters = this.adapters.filter(a => a.hasInitialConfiguarations());
// If there is only one adapter with an initial configuration automatically pick it to simplify debug setup
const promise = adapters.length === 1 ? TPromise.as(adapters[0]) :
this.quickOpenService.pick([...adapters, { label: 'More...' }], { placeHolder: nls.localize('selectDebug', "Select Environment") });
return this.fileService.resolveContent(resource).then(content => true, err =>
this.quickOpenService.pick([...this.adapters, { label: 'More...' }], { placeHolder: nls.localize('selectDebug', "Select Environment") })
.then(picked => {
if (picked instanceof Adapter) {
return picked ? picked.getInitialConfigurationContent() : null;
}
if (picked) {
return this.viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true)
.then(viewlet => viewlet as IExtensionsViewlet)
.then(viewlet => {
viewlet.search('tag:debuggers');
viewlet.focus();
return null;
});
}
})
.then(content => {
if (!content) {
return false;
}
return promise.then(picked => {
if (picked instanceof Adapter) {
return picked ? picked.getInitialConfigurationContent() : null;
}
if (picked) {
return this.viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true)
.then(viewlet => viewlet as IExtensionsViewlet)
.then(viewlet => {
viewlet.search('tag:debuggers');
viewlet.focus();
return null;
});
}
}).then(content => {
if (!content) {
configFileCreated = true;
return this.fileService.updateContent(resource, content).then(() => true);
}))
.then(errorFree => {
if (!errorFree) {
return false;
}
this.telemetryService.publicLog('debugConfigure');
configFileCreated = true;
return this.fileService.updateContent(resource, content).then(() => true);
return this.editorService.openEditor({
resource: resource,
options: {
forceOpen: true,
pinned: configFileCreated, // pin only if config file is created #8727
revealIfVisible: true
},
}, sideBySide).then(() => true);
}, (error) => {
throw new Error(nls.localize('DebugConfig.failed', "Unable to create 'launch.json' file inside the '.vscode' folder ({0}).", error));
});
}).then(errorFree => {
if (!errorFree) {
return false;
}
this.telemetryService.publicLog('debugConfigure');
return this.editorService.openEditor({
resource: resource,
options: {
forceOpen: true,
pinned: configFileCreated, // pin only if config file is created #8727
revealIfVisible: true
},
}, sideBySide).then(() => true);
}, (error) => {
throw new Error(nls.localize('DebugConfig.failed', "Unable to create 'launch.json' file inside the '.vscode' folder ({0}).", error));
});
}
public canSetBreakpointsIn(model: IModel): boolean {
@@ -76,10 +76,6 @@ export class Adapter {
return this.rawAdapter.configurationSnippets;
}
public hasInitialConfiguarations(): boolean {
return !!this.rawAdapter.initialConfigurations;
}
public merge(secondRawAdapter: IRawAdapter, extensionDescription: IExtensionDescription): void {
// Give priority to built in debug adapters
if (extensionDescription.isBuiltin) {