mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-14 20:34:30 +01:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user