Vscode merge (#4582)

* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd

* fix issues with merges

* bump node version in azpipe

* replace license headers

* remove duplicate launch task

* fix build errors

* fix build errors

* fix tslint issues

* working through package and linux build issues

* more work

* wip

* fix packaged builds

* working through linux build errors

* wip

* wip

* wip

* fix mac and linux file limits

* iterate linux pipeline

* disable editor typing

* revert series to parallel

* remove optimize vscode from linux

* fix linting issues

* revert testing change

* add work round for new node

* readd packaging for extensions

* fix issue with angular not resolving decorator dependencies
This commit is contained in:
Anthony Dresser
2019-03-19 17:44:35 -07:00
committed by GitHub
parent 833d197412
commit 87765e8673
1879 changed files with 54505 additions and 38058 deletions

View File

@@ -6,9 +6,9 @@
import 'vs/css!./quickInput';
import { Component } from 'vs/workbench/common/component';
import { IQuickInputService, IQuickPickItem, IPickOptions, IInputOptions, IQuickNavigateConfiguration, IQuickPick, IQuickInput, IQuickInputButton, IInputBox, IQuickPickItemButtonEvent, QuickPickInput, IQuickPickSeparator, IKeyMods } from 'vs/platform/quickinput/common/quickInput';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import * as dom from 'vs/base/browser/dom';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { contrastBorder, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
import { SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND } from 'vs/workbench/common/theme';
@@ -29,10 +29,10 @@ import { Emitter, Event } from 'vs/base/common/event';
import { Button } from 'vs/base/browser/ui/button/button';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import Severity from 'vs/base/common/severity';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { ICommandAndKeybindingRule, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { inQuickOpenContext } from 'vs/workbench/browser/parts/quickopen/quickopen';
import { inQuickOpenContext, InQuickOpenContextKey } from 'vs/workbench/browser/parts/quickopen/quickopen';
import { ActionBar, ActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { Action } from 'vs/base/common/actions';
import { URI } from 'vs/base/common/uri';
@@ -40,10 +40,10 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { equals } from 'vs/base/common/arrays';
import { TimeoutTimer } from 'vs/base/common/async';
import { getIconClass } from 'vs/workbench/browser/parts/quickinput/quickInputUtils';
import { AccessibilitySupport } from 'vs/base/common/platform';
import * as browser from 'vs/base/browser/browser';
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
const $ = dom.$;
@@ -115,7 +115,7 @@ class QuickInput implements IQuickInput {
this.onDidHideEmitter,
];
private busyDelay: TimeoutTimer;
private busyDelay: TimeoutTimer | null;
constructor(protected ui: QuickInputUI) {
}
@@ -252,21 +252,21 @@ class QuickInput implements IQuickInput {
this.ui.leftActionBar.clear();
const leftButtons = this.buttons.filter(button => button === backButton);
this.ui.leftActionBar.push(leftButtons.map((button, index) => {
const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath), true, () => {
const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath!), true, () => {
this.onDidTriggerButtonEmitter.fire(button);
return Promise.resolve(null);
});
action.tooltip = button.tooltip;
action.tooltip = button.tooltip || '';
return action;
}), { icon: true, label: false });
this.ui.rightActionBar.clear();
const rightButtons = this.buttons.filter(button => button !== backButton);
this.ui.rightActionBar.push(rightButtons.map((button, index) => {
const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath), true, () => {
const action = new Action(`id-${index}`, '', button.iconClass || getIconClass(button.iconPath!), true, () => {
this.onDidTriggerButtonEmitter.fire(button);
return Promise.resolve(null);
});
action.tooltip = button.tooltip;
action.tooltip = button.tooltip || '';
return action;
}), { icon: true, label: false });
}
@@ -311,21 +311,26 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
private _value = '';
private _placeholder;
private onDidChangeValueEmitter = new Emitter<string>();
private onDidAcceptEmitter = new Emitter<string>();
private onDidAcceptEmitter = new Emitter<void>();
private _items: Array<T | IQuickPickSeparator> = [];
private itemsUpdated = false;
private _canSelectMany = false;
private _matchOnDescription = false;
private _matchOnDetail = false;
private _matchOnLabel = true;
private _autoFocusOnList = true;
private _activeItems: T[] = [];
private activeItemsUpdated = false;
private activeItemsToConfirm: T[] = [];
private activeItemsToConfirm: T[] | null = [];
private onDidChangeActiveEmitter = new Emitter<T[]>();
private _selectedItems: T[] = [];
private selectedItemsUpdated = false;
private selectedItemsToConfirm: T[] = [];
private selectedItemsToConfirm: T[] | null = [];
private onDidChangeSelectionEmitter = new Emitter<T[]>();
private onDidTriggerItemButtonEmitter = new Emitter<IQuickPickItemButtonEvent<T>>();
private _valueSelection: Readonly<[number, number]>;
private valueSelectionUpdated = true;
private _validationMessage: string;
quickNavigate: IQuickNavigateConfiguration;
@@ -399,6 +404,24 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
this.update();
}
get matchOnLabel() {
return this._matchOnLabel;
}
set matchOnLabel(matchOnLabel: boolean) {
this._matchOnLabel = matchOnLabel;
this.update();
}
get autoFocusOnList() {
return this._autoFocusOnList;
}
set autoFocusOnList(autoFocusOnList: boolean) {
this._autoFocusOnList = autoFocusOnList;
this.update();
}
get activeItems() {
return this._activeItems;
}
@@ -425,10 +448,33 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
return this.ui.keyMods;
}
set valueSelection(valueSelection: Readonly<[number, number]>) {
this._valueSelection = valueSelection;
this.valueSelectionUpdated = true;
this.update();
}
get validationMessage() {
return this._validationMessage;
}
set validationMessage(validationMessage: string) {
this._validationMessage = validationMessage;
this.update();
}
onDidChangeSelection = this.onDidChangeSelectionEmitter.event;
onDidTriggerItemButton = this.onDidTriggerItemButtonEmitter.event;
private trySelectFirst() {
if (this.autoFocusOnList) {
if (!this.ui.isScreenReaderOptimized() && !this.canSelectMany) {
this.ui.list.focus('First');
}
}
}
show() {
if (!this.visible) {
this.visibleDisposables.push(
@@ -438,11 +484,14 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
}
this._value = value;
this.ui.list.filter(this.ui.inputBox.value);
if (!this.ui.isScreenReaderOptimized() && !this.canSelectMany) {
this.ui.list.focus('First');
}
this.trySelectFirst();
this.onDidChangeValueEmitter.fire(value);
}),
this.ui.inputBox.onMouseDown(event => {
if (!this.autoFocusOnList) {
this.ui.list.clearFocus();
}
}),
this.ui.inputBox.onKeyDown(event => {
switch (event.keyCode) {
case KeyCode.DownArrow:
@@ -529,6 +578,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
this.ui.list.onButtonTriggered(event => this.onDidTriggerItemButtonEmitter.fire(event as IQuickPickItemButtonEvent<T>)),
this.registerQuickNavigation()
);
this.valueSelectionUpdated = true;
}
super.show(); // TODO: Why have show() bubble up while update() trickles down? (Could move setComboboxAccessibility() here.)
}
@@ -589,6 +639,10 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
if (this.ui.inputBox.value !== this.value) {
this.ui.inputBox.value = this.value;
}
if (this.valueSelectionUpdated) {
this.valueSelectionUpdated = false;
this.ui.inputBox.select(this._valueSelection && { start: this._valueSelection[0], end: this._valueSelection[1] });
}
if (this.ui.inputBox.placeholder !== (this.placeholder || '')) {
this.ui.inputBox.placeholder = (this.placeholder || '');
}
@@ -599,15 +653,13 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
this.ui.checkAll.checked = this.ui.list.getAllVisibleChecked();
this.ui.visibleCount.setCount(this.ui.list.getVisibleCount());
this.ui.count.setCount(this.ui.list.getCheckedCount());
if (!this.ui.isScreenReaderOptimized() && !this.canSelectMany) {
this.ui.list.focus('First');
}
this.trySelectFirst();
}
if (this.ui.container.classList.contains('show-checkboxes') !== !!this.canSelectMany) {
if (this.canSelectMany) {
this.ui.list.clearFocus();
} else if (!this.ui.isScreenReaderOptimized()) {
this.ui.list.focus('First');
} else {
this.trySelectFirst();
}
}
if (this.activeItemsUpdated) {
@@ -630,11 +682,19 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
this.selectedItemsToConfirm = null;
}
}
if (this.validationMessage) {
this.ui.message.textContent = this.validationMessage;
this.ui.inputBox.showDecoration(Severity.Error);
} else {
this.ui.message.textContent = null;
this.ui.inputBox.showDecoration(Severity.Ignore);
}
this.ui.list.matchOnDescription = this.matchOnDescription;
this.ui.list.matchOnDetail = this.matchOnDetail;
this.ui.list.matchOnLabel = this.matchOnLabel;
this.ui.setComboboxAccessibility(true);
this.ui.inputBox.setAttribute('aria-label', QuickPick.INPUT_BOX_ARIA_LABEL);
this.ui.setVisibilities(this.canSelectMany ? { title: !!this.title || !!this.step, checkAll: true, inputBox: true, visibleCount: true, count: true, ok: true, list: true } : { title: !!this.title || !!this.step, inputBox: true, visibleCount: true, list: true });
this.ui.setVisibilities(this.canSelectMany ? { title: !!this.title || !!this.step, checkAll: true, inputBox: true, visibleCount: true, count: true, ok: true, list: true, message: !!this.validationMessage } : { title: !!this.title || !!this.step, inputBox: true, visibleCount: true, list: true, message: !!this.validationMessage });
}
}
@@ -651,7 +711,7 @@ class InputBox extends QuickInput implements IInputBox {
private noValidationMessage = InputBox.noPromptMessage;
private _validationMessage: string;
private onDidValueChangeEmitter = new Emitter<string>();
private onDidAcceptEmitter = new Emitter<string>();
private onDidAcceptEmitter = new Emitter<void>();
constructor(ui: QuickInputUI) {
super(ui);
@@ -768,13 +828,12 @@ class InputBox extends QuickInput implements IInputBox {
export class QuickInputService extends Component implements IQuickInputService {
public _serviceBrand: any;
public _serviceBrand: ServiceIdentifier<any>;
private static readonly ID = 'workbench.component.quickinput';
private static readonly MAX_WIDTH = 600; // Max total width of quick open widget
private idPrefix = 'quickInput_'; // Constant since there is still only one.
private layoutDimensions: dom.Dimension;
private titleBar: HTMLElement;
private filterContainer: HTMLElement;
private visibleCountContainer: HTMLElement;
@@ -791,24 +850,26 @@ export class QuickInputService extends Component implements IQuickInputService {
private onDidTriggerButtonEmitter = this._register(new Emitter<IQuickInputButton>());
private keyMods: Writeable<IKeyMods> = { ctrlCmd: false, alt: false };
private controller: QuickInput;
private controller: QuickInput | null = null;
constructor(
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IPartService private readonly partService: IPartService,
@IQuickOpenService private readonly quickOpenService: IQuickOpenService,
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IThemeService themeService: IThemeService,
@IStorageService storageService: IStorageService
@IStorageService storageService: IStorageService,
@IAccessibilityService private readonly accessibilityService: IAccessibilityService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(QuickInputService.ID, themeService, storageService);
this.inQuickOpenContext = new RawContextKey<boolean>('inQuickOpen', false).bindTo(contextKeyService);
this.inQuickOpenContext = InQuickOpenContextKey.bindTo(contextKeyService);
this._register(this.quickOpenService.onShow(() => this.inQuickOpen('quickOpen', true)));
this._register(this.quickOpenService.onHide(() => this.inQuickOpen('quickOpen', false)));
this._register(this.layoutService.onLayout(dimension => this.layout(dimension)));
this.registerKeyModsListeners();
}
@@ -830,7 +891,7 @@ export class QuickInputService extends Component implements IQuickInputService {
}
private setContextKey(id?: string) {
let key: IContextKey<boolean>;
let key: IContextKey<boolean> | undefined;
if (id) {
key = this.contexts[id];
if (!key) {
@@ -860,7 +921,7 @@ export class QuickInputService extends Component implements IQuickInputService {
}
private registerKeyModsListeners() {
const workbench = this.partService.getWorkbenchElement();
const workbench = this.layoutService.getWorkbenchElement();
this._register(dom.addDisposableListener(workbench, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
const event = new StandardKeyboardEvent(e);
switch (event.keyCode) {
@@ -892,7 +953,7 @@ export class QuickInputService extends Component implements IQuickInputService {
return;
}
const workbench = this.partService.getWorkbenchElement();
const workbench = this.layoutService.getWorkbenchElement();
const container = dom.append(workbench, $('.quick-input-widget.show-file-icons'));
container.tabIndex = -1;
container.style.display = 'none';
@@ -971,7 +1032,7 @@ export class QuickInputService extends Component implements IQuickInputService {
}));
this._register(list.onDidChangeFocus(() => {
if (this.comboboxAccessibility) {
this.ui.inputBox.setAttribute('aria-activedescendant', this.ui.list.getActiveDescendant());
this.ui.inputBox.setAttribute('aria-activedescendant', this.ui.list.getActiveDescendant() || '');
}
}));
@@ -1060,7 +1121,7 @@ export class QuickInputService extends Component implements IQuickInputService {
return;
}
const input = this.createQuickPick<T>();
let activeItem: T;
let activeItem: T | undefined;
const disposables = [
input,
input.onDidAccept(() => {
@@ -1114,15 +1175,17 @@ export class QuickInputService extends Component implements IQuickInputService {
resolve(undefined);
}),
];
input.canSelectMany = options.canPickMany;
input.canSelectMany = !!options.canPickMany;
input.placeholder = options.placeHolder;
input.ignoreFocusOut = options.ignoreFocusLost;
input.matchOnDescription = options.matchOnDescription;
input.matchOnDetail = options.matchOnDetail;
input.ignoreFocusOut = !!options.ignoreFocusLost;
input.matchOnDescription = !!options.matchOnDescription;
input.matchOnDetail = !!options.matchOnDetail;
input.matchOnLabel = (options.matchOnLabel === undefined) || options.matchOnLabel; // default to true
input.autoFocusOnList = (options.autoFocusOnList === undefined) || options.autoFocusOnList; // default to true
input.quickNavigate = options.quickNavigate;
input.contextKey = options.contextKey;
input.busy = true;
Promise.all([picks, options.activeItem])
Promise.all<QuickPickInput<T>[], T | undefined>([picks, options.activeItem])
.then(([items, _activeItem]) => {
activeItem = _activeItem;
input.busy = false;
@@ -1162,7 +1225,7 @@ export class QuickInputService extends Component implements IQuickInputService {
}
validation.then(result => {
if (value === validationValue) {
input.validationMessage = result;
input.validationMessage = result || undefined;
}
});
}),
@@ -1189,12 +1252,12 @@ export class QuickInputService extends Component implements IQuickInputService {
resolve(undefined);
}),
];
input.value = options.value;
input.value = options.value || '';
input.valueSelection = options.valueSelection;
input.prompt = options.prompt;
input.placeholder = options.placeHolder;
input.password = options.password;
input.ignoreFocusOut = options.ignoreFocusLost;
input.password = !!options.password;
input.ignoreFocusOut = !!options.ignoreFocusLost;
input.show();
});
}
@@ -1236,6 +1299,7 @@ export class QuickInputService extends Component implements IQuickInputService {
this.ui.list.setElements([]);
this.ui.list.matchOnDescription = false;
this.ui.list.matchOnDetail = false;
this.ui.list.matchOnLabel = true;
this.ui.ignoreFocusOut = false;
this.setComboboxAccessibility(false);
this.ui.inputBox.removeAttribute('aria-label');
@@ -1259,7 +1323,7 @@ export class QuickInputService extends Component implements IQuickInputService {
this.countContainer.style.display = visibilities.count ? '' : 'none';
this.okContainer.style.display = visibilities.ok ? '' : 'none';
this.ui.message.style.display = visibilities.message ? '' : 'none';
this.ui.list.display(visibilities.list);
this.ui.list.display(!!visibilities.list);
this.ui.container.classList[visibilities.checkAll ? 'add' : 'remove']('show-checkboxes');
this.updateLayout(); // TODO
}
@@ -1271,7 +1335,7 @@ export class QuickInputService extends Component implements IQuickInputService {
this.ui.inputBox.setAttribute('role', 'combobox');
this.ui.inputBox.setAttribute('aria-haspopup', 'true');
this.ui.inputBox.setAttribute('aria-autocomplete', 'list');
this.ui.inputBox.setAttribute('aria-activedescendant', this.ui.list.getActiveDescendant());
this.ui.inputBox.setAttribute('aria-activedescendant', this.ui.list.getActiveDescendant() || '');
} else {
this.ui.inputBox.removeAttribute('role');
this.ui.inputBox.removeAttribute('aria-haspopup');
@@ -1282,7 +1346,7 @@ export class QuickInputService extends Component implements IQuickInputService {
}
private isScreenReaderOptimized() {
const detected = browser.getAccessibilitySupport() === AccessibilitySupport.Enabled;
const detected = this.accessibilityService.getAccessibilitySupport() === AccessibilitySupport.Enabled;
const config = this.configurationService.getValue<IEditorOptions>('editor').accessibilitySupport;
return config === 'on' || (config === 'auto' && detected);
}
@@ -1354,17 +1418,16 @@ export class QuickInputService extends Component implements IQuickInputService {
}
layout(dimension: dom.Dimension): void {
this.layoutDimensions = dimension;
this.updateLayout();
}
private updateLayout() {
if (this.layoutDimensions && this.ui) {
const titlebarOffset = this.partService.getTitleBarOffset();
if (this.ui) {
const titlebarOffset = this.layoutService.getTitleBarOffset();
this.ui.container.style.top = `${titlebarOffset}px`;
const style = this.ui.container.style;
const width = Math.min(this.layoutDimensions.width * 0.62 /* golden cut */, QuickInputService.MAX_WIDTH);
const width = Math.min(this.layoutService.dimension.width * 0.62 /* golden cut */, QuickInputService.MAX_WIDTH);
style.width = width + 'px';
style.marginLeft = '-' + (width / 2) + 'px';
@@ -1400,7 +1463,7 @@ export const QuickPickManyToggle: ICommandAndKeybindingRule = {
id: 'workbench.action.quickPickManyToggle',
weight: KeybindingWeight.WorkbenchContrib,
when: inQuickOpenContext,
primary: undefined,
primary: 0,
handler: accessor => {
const quickInputService = accessor.get(IQuickInputService);
quickInputService.toggle();
@@ -1418,6 +1481,8 @@ export class BackAction extends Action {
public run(): Promise<any> {
this.quickInputService.back();
return Promise.resolve(null);
return Promise.resolve();
}
}
registerSingleton(IQuickInputService, QuickInputService, true);