Merge from vscode 1ec43773e37997841c5af42b33ddb180e9735bf2

This commit is contained in:
ADS Merger
2020-03-29 01:29:32 +00:00
parent 586ec50916
commit a64304602e
316 changed files with 6524 additions and 11687 deletions

View File

@@ -663,10 +663,10 @@ class CallStackDelegate implements IListVirtualDelegate<CallStackItem> {
getHeight(element: CallStackItem): number {
if (element instanceof StackFrame && element.presentationHint === 'label') {
return 12;
return 16;
}
if (element instanceof ThreadAndSessionIds || element instanceof Array) {
return 12;
return 16;
}
return 22;

View File

@@ -27,13 +27,11 @@ import { DebugToolBar } from 'vs/workbench/contrib/debug/browser/debugToolBar';
import * as service from 'vs/workbench/contrib/debug/browser/debugService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { registerCommands, ADD_CONFIGURATION_ID, TOGGLE_INLINE_BREAKPOINT_ID, COPY_STACK_TRACE_ID, REVERSE_CONTINUE_ID, STEP_BACK_ID, RESTART_SESSION_ID, TERMINATE_THREAD_ID, STEP_OVER_ID, STEP_INTO_ID, STEP_OUT_ID, PAUSE_ID, DISCONNECT_ID, STOP_ID, RESTART_FRAME_ID, CONTINUE_ID, FOCUS_REPL_ID, JUMP_TO_CURSOR_ID, RESTART_LABEL, STEP_INTO_LABEL, STEP_OVER_LABEL, STEP_OUT_LABEL, PAUSE_LABEL, DISCONNECT_LABEL, STOP_LABEL, CONTINUE_LABEL } from 'vs/workbench/contrib/debug/browser/debugCommands';
import { IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen';
import { StatusBarColorProvider } from 'vs/workbench/contrib/debug/browser/statusbarColorProvider';
import { IViewsRegistry, Extensions as ViewExtensions, IViewContainersRegistry, ViewContainerLocation, ViewContainer } from 'vs/workbench/common/views';
import { isMacintosh } from 'vs/base/common/platform';
import { ContextKeyExpr, ContextKeyExpression } from 'vs/platform/contextkey/common/contextkey';
import { URI } from 'vs/base/common/uri';
import { DebugQuickOpenHandler } from 'vs/workbench/contrib/debug/browser/debugQuickOpen';
import { DebugStatusContribution } from 'vs/workbench/contrib/debug/browser/debugStatus';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { launchSchemaId } from 'vs/workbench/services/configuration/common/configuration';
@@ -169,17 +167,6 @@ registerDebugCommandPaletteItem(RunToCursorAction.ID, RunToCursorAction.LABEL, C
registerDebugCommandPaletteItem(TOGGLE_INLINE_BREAKPOINT_ID, nls.localize('inlineBreakpoint', "Inline Breakpoint"));
// Register Quick Open
(Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen)).registerQuickOpenHandler(
QuickOpenHandlerDescriptor.create(
DebugQuickOpenHandler,
DebugQuickOpenHandler.ID,
'debug ',
'inLaunchConfigurationsPicker',
nls.localize('debugCommands', "Debug Configuration")
)
);
// Register Quick Access
Registry.as<IQuickAccessRegistry>(QuickAccessExtensions.Quickaccess).registerQuickAccessProvider({
ctor: StartDebugQuickAccessProvider,

View File

@@ -10,7 +10,6 @@ import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/
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';
@@ -174,13 +173,13 @@ export class SelectAndStartAction extends AbstractDebugAction {
constructor(id: string, label: string,
@IDebugService debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IQuickOpenService private readonly quickOpenService: IQuickOpenService
@IQuickInputService private readonly quickInputService: IQuickInputService
) {
super(id, label, '', debugService, keybindingService);
}
run(): Promise<any> {
return this.quickOpenService.show('debug ');
async run(): Promise<any> {
this.quickInputService.quickAccess.show('debug ');
}
}

View File

@@ -1,145 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { IDebugService, ILaunch } from 'vs/workbench/contrib/debug/common/debug';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { StartAction } from 'vs/workbench/contrib/debug/browser/debugActions';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { CancellationToken } from 'vs/base/common/cancellation';
import { QuickOpenEntry, QuickOpenModel, QuickOpenEntryGroup, IHighlight } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { Mode, IAutoFocus } from 'vs/base/parts/quickopen/common/quickOpen';
import { QuickOpenHandler } from 'vs/workbench/browser/quickopen';
import { matchesFuzzy } from 'vs/base/common/filters';
class AddConfigEntry extends QuickOpenEntry {
constructor(private label: string, private launch: ILaunch, private commandService: ICommandService, private contextService: IWorkspaceContextService, highlights: IHighlight[] = []) {
super(highlights);
}
getLabel(): string {
return this.label;
}
getDescription(): string {
return this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE ? this.launch.name : '';
}
getAriaLabel(): string {
return nls.localize('entryAriaLabel', "{0}, debug", this.getLabel());
}
run(mode: Mode): boolean {
if (mode === Mode.PREVIEW) {
return false;
}
this.commandService.executeCommand('debug.addConfiguration', this.launch.uri.toString());
return true;
}
}
class StartDebugEntry extends QuickOpenEntry {
constructor(private debugService: IDebugService, private contextService: IWorkspaceContextService, private notificationService: INotificationService, private launch: ILaunch, private configurationName: string, highlights: IHighlight[] = []) {
super(highlights);
}
getLabel(): string {
return this.configurationName;
}
getDescription(): string {
return this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE ? this.launch.name : '';
}
getAriaLabel(): string {
return nls.localize('entryAriaLabel', "{0}, debug", this.getLabel());
}
run(mode: Mode): boolean {
if (mode === Mode.PREVIEW || !StartAction.isEnabled(this.debugService)) {
return false;
}
// Run selected debug configuration
this.debugService.getConfigurationManager().selectConfiguration(this.launch, this.configurationName);
this.debugService.startDebugging(this.launch).then(undefined, e => this.notificationService.error(e));
return true;
}
}
export class DebugQuickOpenHandler extends QuickOpenHandler {
static readonly ID = 'workbench.picker.launch';
private autoFocusIndex: number | undefined;
constructor(
@IDebugService private readonly debugService: IDebugService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@ICommandService private readonly commandService: ICommandService,
@INotificationService private readonly notificationService: INotificationService
) {
super();
}
getAriaLabel(): string {
return nls.localize('debugAriaLabel', "Type a name of a launch configuration to run.");
}
getResults(input: string, token: CancellationToken): Promise<QuickOpenModel> {
const configurations: QuickOpenEntry[] = [];
const configManager = this.debugService.getConfigurationManager();
const allConfigurations = configManager.getAllConfigurations();
let lastGroup: string | undefined;
for (let config of allConfigurations) {
const highlights = matchesFuzzy(input, config.name, true);
if (highlights) {
if (config.launch === configManager.selectedConfiguration.launch && config.name === configManager.selectedConfiguration.name) {
this.autoFocusIndex = configurations.length;
}
let entry: QuickOpenEntry = new StartDebugEntry(this.debugService, this.contextService, this.notificationService, config.launch, config.name, highlights);
if (lastGroup !== config.presentation?.group) {
entry = new QuickOpenEntryGroup(entry, undefined, true);
lastGroup = config.presentation?.group;
}
configurations.push(entry);
}
}
configManager.getLaunches().filter(l => !l.hidden).forEach((l, index) => {
const label = this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE ? nls.localize("addConfigTo", "Add Config ({0})...", l.name) : nls.localize('addConfiguration', "Add Configuration...");
const entry = new AddConfigEntry(label, l, this.commandService, this.contextService, matchesFuzzy(input, label, true) || undefined);
if (index === 0) {
configurations.push(new QuickOpenEntryGroup(entry, undefined, true));
} else {
configurations.push(entry);
}
});
return Promise.resolve(new QuickOpenModel(configurations));
}
getAutoFocus(input: string): IAutoFocus {
return {
autoFocusFirstEntry: !!input,
autoFocusIndex: this.autoFocusIndex
};
}
getEmptyLabel(searchString: string): string {
if (searchString.length > 0) {
return nls.localize('noConfigurationsMatching', "No debug configurations matching");
}
return nls.localize('noConfigurationsFound', "No debug configurations found. Please create a 'launch.json' file.");
}
}

View File

@@ -120,6 +120,7 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
this._register(this.debugService.getViewModel().onDidFocusSession(() => this.updateScheduler.schedule()));
this._register(this.debugService.onDidNewSession(() => this.updateScheduler.schedule()));
this._register(this.configurationService.onDidChangeConfiguration(e => this.onDidConfigurationChange(e)));
this._register(this.debugToolBarMenu.onDidChange(() => this.updateScheduler.schedule()));
this._register(this.actionBar.actionRunner.onDidRun((e: IRunEvent) => {
// check for error
if (e.error && !errors.isPromiseCanceledError(e.error)) {

View File

@@ -670,7 +670,7 @@ export class RawDebugSession implements IDisposable {
});
}
if (error && error.format && error.showUser) {
this.notificationService.error(error.format);
this.notificationService.error(userMessage);
}
return new Error(userMessage);

View File

@@ -76,6 +76,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
private static readonly REFRESH_DELAY = 100; // delay in ms to refresh the repl for new elements to show
private static readonly REPL_INPUT_LINE_HEIGHT = 19;
private static readonly URI = uri.parse(`${DEBUG_SCHEME}:replinput`);
private history: HistoryNavigator<string>;
private tree!: WorkbenchAsyncDataTree<IDebugSession, IReplElement, FuzzyScore>;
@@ -210,7 +211,7 @@ export class Repl extends ViewPane implements IHistoryNavigationWidget {
if (!visible) {
dispose(this.model);
} else {
this.model = this.modelService.createModel('', null, uri.parse(`${DEBUG_SCHEME}:replinput`), true);
this.model = this.modelService.getModel(Repl.URI) || this.modelService.createModel('', null, Repl.URI, true);
this.setMode();
this.replInput.setModel(this.model);
this.updateInputDecoration();

View File

@@ -164,7 +164,7 @@ export function prepareCommand(args: DebugProtocol.RunInTerminalRequestArguments
case ShellType.bash:
quote = (s: string) => {
s = s.replace(/([\"\\])/g, '\\$1');
s = s.replace(/(["';\\])/g, '\\$1');
return (s.indexOf(' ') >= 0 || s.length === 0) ? `"${s}"` : s;
};

View File

@@ -17,6 +17,7 @@ suite('Debug - Utils', () => {
assert.strictEqual(formatPII('Foo {0} Bar {1}{2}', false, { '0': 'yes', '1': 'undefined' }), 'Foo yes Bar undefined{2}');
assert.strictEqual(formatPII('Foo {_key0} Bar {key1}{key2}', true, { '_key0': 'yes', 'key1': '5', 'key2': 'false' }), 'Foo yes Bar {key1}{key2}');
assert.strictEqual(formatPII('Foo {_key0} Bar {key1}{key2}', false, { '_key0': 'yes', 'key1': '5', 'key2': 'false' }), 'Foo yes Bar 5false');
assert.strictEqual(formatPII('Unable to display threads:"{e}"', false, { 'e': 'detached from process' }), 'Unable to display threads:"detached from process"');
});
test('getExactExpressionStartAndEnd', () => {