mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 099a7622e6e90dbcc226e428d4e35a72cb19ecbc (#9646)
* Merge from vscode 099a7622e6e90dbcc226e428d4e35a72cb19ecbc * fix strict
This commit is contained in:
@@ -23,6 +23,7 @@ export interface IIconLabelValueOptions {
|
||||
hideIcon?: boolean;
|
||||
extraClasses?: string[];
|
||||
italic?: boolean;
|
||||
strikethrough?: boolean;
|
||||
matches?: IMatch[];
|
||||
labelEscapeNewLines?: boolean;
|
||||
descriptionMatches?: IMatch[];
|
||||
@@ -136,6 +137,10 @@ export class IconLabel extends Disposable {
|
||||
if (options.italic) {
|
||||
classes.push('italic');
|
||||
}
|
||||
|
||||
if (options.strikethrough) {
|
||||
classes.push('strikethrough');
|
||||
}
|
||||
}
|
||||
|
||||
this.domNode.className = classes.join(' ');
|
||||
|
||||
@@ -60,6 +60,11 @@
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.monaco-icon-label.strikethrough > .monaco-icon-label-container > .monaco-icon-name-container > .label-name,
|
||||
.monaco-icon-label.strikethrough > .monaco-icon-description-container > .label-description {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.monaco-icon-label::after {
|
||||
opacity: 0.75;
|
||||
font-size: 90%;
|
||||
|
||||
@@ -319,6 +319,10 @@ export class InputBox extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
public isSelectionAtEnd(): boolean {
|
||||
return this.input.selectionEnd === this.input.value.length && this.input.selectionStart === this.input.selectionEnd;
|
||||
}
|
||||
|
||||
public enable(): void {
|
||||
this.input.removeAttribute('disabled');
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export interface IIdentityProvider<T> {
|
||||
|
||||
export enum ListAriaRootRole {
|
||||
/** default list structure role */
|
||||
LIST = 'list',
|
||||
LIST = 'listbox',
|
||||
|
||||
/** default tree structure role */
|
||||
TREE = 'tree',
|
||||
|
||||
@@ -209,6 +209,10 @@ export abstract class Pane extends Disposable implements IView {
|
||||
|
||||
this.body = append(this.element, $('.pane-body'));
|
||||
this.renderBody(this.body);
|
||||
|
||||
if (!this.isExpanded()) {
|
||||
this.body.remove();
|
||||
}
|
||||
}
|
||||
|
||||
layout(size: number): void {
|
||||
|
||||
@@ -392,7 +392,7 @@ export function anyScore(pattern: string, lowPattern: string, _patternPos: numbe
|
||||
|
||||
//#region --- fuzzyScore ---
|
||||
|
||||
export function createMatches(score: undefined | FuzzyScore): IMatch[] {
|
||||
export function createMatches(score: undefined | FuzzyScore, offset = 0): IMatch[] {
|
||||
if (typeof score === 'undefined') {
|
||||
return [];
|
||||
}
|
||||
@@ -407,7 +407,7 @@ export function createMatches(score: undefined | FuzzyScore): IMatch[] {
|
||||
if (last && last.end === pos) {
|
||||
last.end = pos + 1;
|
||||
} else {
|
||||
res.push({ start: pos, end: pos + 1 });
|
||||
res.push({ start: pos + offset, end: pos + 1 + offset });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ const _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
|
||||
* (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
|
||||
* and encoding.
|
||||
*
|
||||
* ```txt
|
||||
* foo://example.com:8042/over/there?name=ferret#nose
|
||||
* \_/ \______________/\_________/ \_________/ \__/
|
||||
* | | | | |
|
||||
@@ -92,6 +93,7 @@ const _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
|
||||
* | _____________________|__
|
||||
* / \ / \
|
||||
* urn:example:animal:ferret:nose
|
||||
* ```
|
||||
*/
|
||||
export class URI implements UriComponents {
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/quickInput';
|
||||
import { IQuickPickItem, IPickOptions, IInputOptions, IQuickNavigateConfiguration, IQuickPick, IQuickInput, IQuickInputButton, IInputBox, IQuickPickItemButtonEvent, QuickPickInput, IQuickPickSeparator, IKeyMods } from 'vs/base/parts/quickinput/common/quickInput';
|
||||
import { IQuickPickItem, IPickOptions, IInputOptions, IQuickNavigateConfiguration, IQuickPick, IQuickInput, IQuickInputButton, IInputBox, IQuickPickItemButtonEvent, QuickPickInput, IQuickPickSeparator, IKeyMods, IQuickPickAcceptEvent } from 'vs/base/parts/quickinput/common/quickInput';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { QuickInputList } from './quickInputList';
|
||||
@@ -379,11 +379,12 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
private _ariaLabel = QuickPick.DEFAULT_ARIA_LABEL;
|
||||
private _placeholder: string | undefined;
|
||||
private readonly onDidChangeValueEmitter = this._register(new Emitter<string>());
|
||||
private readonly onDidAcceptEmitter = this._register(new Emitter<void>());
|
||||
private readonly onDidAcceptEmitter = this._register(new Emitter<IQuickPickAcceptEvent>());
|
||||
private readonly onDidCustomEmitter = this._register(new Emitter<void>());
|
||||
private _items: Array<T | IQuickPickSeparator> = [];
|
||||
private itemsUpdated = false;
|
||||
private _canSelectMany = false;
|
||||
private _canAcceptInBackground = false;
|
||||
private _matchOnDescription = false;
|
||||
private _matchOnDetail = false;
|
||||
private _matchOnLabel = true;
|
||||
@@ -462,6 +463,14 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
this.update();
|
||||
}
|
||||
|
||||
get canAcceptInBackground() {
|
||||
return this._canAcceptInBackground;
|
||||
}
|
||||
|
||||
set canAcceptInBackground(canAcceptInBackground: boolean) {
|
||||
this._canAcceptInBackground = canAcceptInBackground;
|
||||
}
|
||||
|
||||
get matchOnDescription() {
|
||||
return this._matchOnDescription;
|
||||
}
|
||||
@@ -663,6 +672,22 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
this.ui.list.domFocus();
|
||||
}
|
||||
event.preventDefault();
|
||||
break;
|
||||
case KeyCode.RightArrow:
|
||||
if (!this._canAcceptInBackground) {
|
||||
return; // needs to be enabled
|
||||
}
|
||||
|
||||
if (!this.ui.inputBox.isSelectionAtEnd()) {
|
||||
return; // ensure input box selection at end
|
||||
}
|
||||
|
||||
if (this.activeItems[0]) {
|
||||
this._selectedItems = [this.activeItems[0]];
|
||||
this.onDidChangeSelectionEmitter.fire(this.selectedItems);
|
||||
this.onDidAcceptEmitter.fire({ inBackground: true });
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}));
|
||||
@@ -671,7 +696,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
this._selectedItems = [this.activeItems[0]];
|
||||
this.onDidChangeSelectionEmitter.fire(this.selectedItems);
|
||||
}
|
||||
this.onDidAcceptEmitter.fire(undefined);
|
||||
this.onDidAcceptEmitter.fire({ inBackground: false });
|
||||
}));
|
||||
this.visibleDisposables.add(this.ui.onDidCustom(() => {
|
||||
this.onDidCustomEmitter.fire(undefined);
|
||||
@@ -686,7 +711,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
this._activeItems = focusedItems as T[];
|
||||
this.onDidChangeActiveEmitter.fire(focusedItems as T[]);
|
||||
}));
|
||||
this.visibleDisposables.add(this.ui.list.onDidChangeSelection(selectedItems => {
|
||||
this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({ items: selectedItems, event }) => {
|
||||
if (this.canSelectMany) {
|
||||
if (selectedItems.length) {
|
||||
this.ui.list.setSelectedElements([]);
|
||||
@@ -699,7 +724,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
this._selectedItems = selectedItems as T[];
|
||||
this.onDidChangeSelectionEmitter.fire(selectedItems as T[]);
|
||||
if (selectedItems.length) {
|
||||
this.onDidAcceptEmitter.fire(undefined);
|
||||
this.onDidAcceptEmitter.fire({ inBackground: event instanceof MouseEvent && event.button === 1 /* mouse middle click */ });
|
||||
}
|
||||
}));
|
||||
this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(checkedItems => {
|
||||
@@ -762,7 +787,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
|
||||
if (wasTriggerKeyPressed && this.activeItems[0]) {
|
||||
this._selectedItems = [this.activeItems[0]];
|
||||
this.onDidChangeSelectionEmitter.fire(this.selectedItems);
|
||||
this.onDidAcceptEmitter.fire(undefined);
|
||||
this.onDidAcceptEmitter.fire({ inBackground: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,7 +54,11 @@ export class QuickInputBox extends Disposable {
|
||||
this.inputBox.select(range);
|
||||
}
|
||||
|
||||
setPlaceholder(placeholder: string) {
|
||||
isSelectionAtEnd(): boolean {
|
||||
return this.inputBox.isSelectionAtEnd();
|
||||
}
|
||||
|
||||
setPlaceholder(placeholder: string): void {
|
||||
this.inputBox.setPlaceHolder(placeholder);
|
||||
}
|
||||
|
||||
@@ -90,11 +94,11 @@ export class QuickInputBox extends Disposable {
|
||||
return this.inputBox.hasFocus();
|
||||
}
|
||||
|
||||
setAttribute(name: string, value: string) {
|
||||
setAttribute(name: string, value: string): void {
|
||||
this.inputBox.inputElement.setAttribute(name, value);
|
||||
}
|
||||
|
||||
removeAttribute(name: string) {
|
||||
removeAttribute(name: string): void {
|
||||
this.inputBox.inputElement.removeAttribute(name);
|
||||
}
|
||||
|
||||
@@ -118,7 +122,7 @@ export class QuickInputBox extends Disposable {
|
||||
this.inputBox.layout();
|
||||
}
|
||||
|
||||
style(styles: IInputBoxStyles) {
|
||||
style(styles: IInputBoxStyles): void {
|
||||
this.inputBox.style(styles);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ class ListElementRenderer implements IListRenderer<ListElement, IListElementTemp
|
||||
options.descriptionMatches = descriptionHighlights || [];
|
||||
options.extraClasses = element.item.iconClasses;
|
||||
options.italic = element.item.italic;
|
||||
options.strikethrough = element.item.strikethrough;
|
||||
data.label.setLabel(element.saneLabel, element.saneDescription, options);
|
||||
|
||||
// Keybinding
|
||||
@@ -317,7 +318,7 @@ export class QuickInputList {
|
||||
|
||||
@memoize
|
||||
get onDidChangeSelection() {
|
||||
return Event.map(this.list.onDidChangeSelection, e => e.elements.map(e => e.item));
|
||||
return Event.map(this.list.onDidChangeSelection, e => ({ items: e.elements.map(e => e.item), event: e.browserEvent }));
|
||||
}
|
||||
|
||||
getAllVisibleChecked() {
|
||||
|
||||
@@ -24,9 +24,15 @@ export interface IQuickPickItem {
|
||||
ariaLabel?: string;
|
||||
description?: string;
|
||||
detail?: string;
|
||||
/**
|
||||
* Allows to show a keybinding next to the item to indicate
|
||||
* how the item can be triggered outside of the picker using
|
||||
* keyboard shortcut.
|
||||
*/
|
||||
keybinding?: ResolvedKeybinding;
|
||||
iconClasses?: string[];
|
||||
italic?: boolean;
|
||||
strikethrough?: boolean;
|
||||
highlights?: IQuickPickItemHighlights;
|
||||
buttons?: IQuickInputButton[];
|
||||
/**
|
||||
@@ -170,6 +176,15 @@ export interface IQuickInput extends IDisposable {
|
||||
hide(): void;
|
||||
}
|
||||
|
||||
export interface IQuickPickAcceptEvent {
|
||||
|
||||
/**
|
||||
* Signals if the picker item is to be accepted
|
||||
* in the background while keeping the picker open.
|
||||
*/
|
||||
inBackground: boolean;
|
||||
}
|
||||
|
||||
export interface IQuickPick<T extends IQuickPickItem> extends IQuickInput {
|
||||
|
||||
value: string;
|
||||
@@ -186,7 +201,14 @@ export interface IQuickPick<T extends IQuickPickItem> extends IQuickInput {
|
||||
|
||||
readonly onDidChangeValue: Event<string>;
|
||||
|
||||
readonly onDidAccept: Event<void>;
|
||||
readonly onDidAccept: Event<IQuickPickAcceptEvent>;
|
||||
|
||||
/**
|
||||
* If enabled, will fire the `onDidAccept` event when
|
||||
* pressing the arrow-right key with the idea of accepting
|
||||
* the selected item without closing the picker.
|
||||
*/
|
||||
canAcceptInBackground: boolean;
|
||||
|
||||
ok: boolean | 'default';
|
||||
|
||||
@@ -268,7 +290,6 @@ export interface IQuickInputButton {
|
||||
/** iconPath or iconClass required */
|
||||
iconClass?: string;
|
||||
tooltip?: string;
|
||||
alwaysShow?: boolean;
|
||||
}
|
||||
|
||||
export interface IQuickPickItemButtonEvent<T extends IQuickPickItem> {
|
||||
|
||||
@@ -45,8 +45,7 @@ export class HeightMap {
|
||||
totalSize = viewItem.top + viewItem.height;
|
||||
}
|
||||
|
||||
let boundSplice = this.heightMap.splice.bind(this.heightMap, i, 0);
|
||||
|
||||
const startingIndex = i;
|
||||
let itemsToInsert: IViewItem[] = [];
|
||||
|
||||
while (item = iterator.next()) {
|
||||
@@ -58,7 +57,7 @@ export class HeightMap {
|
||||
sizeDiff += viewItem.height;
|
||||
}
|
||||
|
||||
boundSplice.apply(this.heightMap, itemsToInsert);
|
||||
this.heightMap.splice(startingIndex, 0, ...itemsToInsert);
|
||||
|
||||
for (j = i; j < this.heightMap.length; j++) {
|
||||
viewItem = this.heightMap[j];
|
||||
|
||||
Reference in New Issue
Block a user