Merge from vscode e74405d11443c5361c31e2bc341866d146eee206 (#8740)

This commit is contained in:
Anthony Dresser
2019-12-18 23:36:29 -08:00
committed by GitHub
parent 48dcb7258e
commit 099916bf19
109 changed files with 1327 additions and 910 deletions

View File

@@ -7,12 +7,13 @@ import * as nls from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IDebugService, State, IEnablement, IBreakpoint, IDebugSession } from 'vs/workbench/contrib/debug/common/debug';
import { IDebugService, State, IEnablement, IBreakpoint, IDebugSession, ILaunch } from 'vs/workbench/contrib/debug/common/debug';
import { Variable, Breakpoint, FunctionBreakpoint } from 'vs/workbench/contrib/debug/common/debugModel';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
export abstract class AbstractDebugAction extends Action {
@@ -60,7 +61,8 @@ export class ConfigureAction extends AbstractDebugAction {
@IDebugService debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@INotificationService private readonly notificationService: INotificationService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IQuickInputService private readonly quickInputService: IQuickInputService
) {
super(id, label, 'debug-action codicon codicon-gear', debugService, keybindingService);
this._register(debugService.getConfigurationManager().onDidSelectConfiguration(() => this.updateClass()));
@@ -87,10 +89,26 @@ export class ConfigureAction extends AbstractDebugAction {
return;
}
const sideBySide = !!(event && (event.ctrlKey || event.metaKey));
const configurationManager = this.debugService.getConfigurationManager();
if (configurationManager.selectedConfiguration.launch) {
return configurationManager.selectedConfiguration.launch.openConfigFile(sideBySide, false);
let launch: ILaunch | undefined;
if (configurationManager.selectedConfiguration.name) {
launch = configurationManager.selectedConfiguration.launch;
} else {
const launches = configurationManager.getLaunches().filter(l => !!l.workspace);
if (launches.length === 1) {
launch = launches[0];
} else {
const picks = launches.map(l => ({ label: l.name, launch: l }));
const picked = await this.quickInputService.pick<{ label: string, launch: ILaunch }>(picks, { activeItem: picks[0], placeHolder: nls.localize('selectWorkspaceFolder', "Select a workspace folder to create a launch.json file in") });
if (picked) {
launch = picked.launch;
}
}
}
if (launch) {
const sideBySide = !!(event && (event.ctrlKey || event.metaKey));
return launch.openConfigFile(sideBySide, false);
}
}
}