mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
export class ToggleDropdownAction extends Action {
|
||||
private static readonly ID = 'dropdownAction.toggle';
|
||||
@@ -14,8 +13,8 @@ export class ToggleDropdownAction extends Action {
|
||||
super(ToggleDropdownAction.ID, label, ToggleDropdownAction.ICON);
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
this._fn();
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as tree from 'vs/base/parts/tree/browser/tree';
|
||||
import * as TreeDefaults from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
@@ -74,17 +73,17 @@ export class DropdownDataSource implements tree.IDataSource {
|
||||
|
||||
public getChildren(tree: tree.ITree, element: Resource | DropdownModel): Promise<any> {
|
||||
if (element instanceof DropdownModel) {
|
||||
return TPromise.as(this.options);
|
||||
return Promise.resolve(this.options);
|
||||
} else {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
public getParent(tree: tree.ITree, element: Resource | DropdownModel): Promise<any> {
|
||||
if (element instanceof DropdownModel) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
} else {
|
||||
return TPromise.as(new DropdownModel());
|
||||
return Promise.resolve(new DropdownModel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { SelectBox, ISelectBoxStyles } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { SelectBox, ISelectBoxStyles, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { IMessage, MessageType, defaultOpts } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
@@ -51,7 +51,7 @@ export class ListBox extends SelectBox {
|
||||
private isValid: boolean;
|
||||
|
||||
constructor(
|
||||
options: string[],
|
||||
options: ISelectOptionItem[],
|
||||
contextViewProvider: IContextViewProvider,
|
||||
private _clipboardService: IClipboardService) {
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
export class CloseTabAction extends Action {
|
||||
private static readonly ID = 'closeTab';
|
||||
@@ -18,12 +17,12 @@ export class CloseTabAction extends Action {
|
||||
super(CloseTabAction.ID, CloseTabAction.LABEL, CloseTabAction.ICON);
|
||||
}
|
||||
|
||||
run(): TPromise<boolean> {
|
||||
run(): Promise<boolean> {
|
||||
try {
|
||||
this.closeFn.apply(this.context);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
} catch (e) {
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import 'vs/css!./scrollableSplitview';
|
||||
import { HeightMap, IView as HeightIView, IViewItem as HeightIViewItem } from './heightMap';
|
||||
|
||||
import { IDisposable, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { mapEvent, Emitter, Event, debounceEvent } from 'vs/base/common/event';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { clamp } from 'vs/base/common/numbers';
|
||||
@@ -186,7 +186,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
|
||||
this.el = document.createElement('div');
|
||||
this.scrollable = new ScrollableElement(this.el, { vertical: options.verticalScrollbarVisibility });
|
||||
debounceEvent(this.scrollable.onScroll, (l, e) => e, types.isNumber(this.options.scrollDebounce) ? this.options.scrollDebounce : 25)(e => {
|
||||
Event.debounce(this.scrollable.onScroll, (l, e) => e, types.isNumber(this.options.scrollDebounce) ? this.options.scrollDebounce : 25)(e => {
|
||||
this.render(e.scrollTop, e.height);
|
||||
this._onScroll.fire(e.scrollTop);
|
||||
});
|
||||
@@ -284,11 +284,11 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey } as ISashEvent)
|
||||
: (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey } as ISashEvent);
|
||||
|
||||
const onStart = mapEvent(sash.onDidStart, sashEventMapper);
|
||||
const onStart = Event.map(sash.onDidStart, sashEventMapper);
|
||||
const onStartDisposable = onStart(this.onSashStart, this);
|
||||
const onChange = mapEvent(sash.onDidChange, sashEventMapper);
|
||||
const onChange = Event.map(sash.onDidChange, sashEventMapper);
|
||||
const onChangeDisposable = onChange(this.onSashChange, this);
|
||||
const onEnd = mapEvent(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash));
|
||||
const onEnd = Event.map(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash));
|
||||
const onEndDisposable = onEnd(this.onSashEnd, this);
|
||||
const onDidResetDisposable = sash.onDidReset(() => this._onDidSashReset.fire(firstIndex(this.sashItems, item => item.sash === sash)));
|
||||
|
||||
@@ -379,11 +379,11 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey } as ISashEvent)
|
||||
: (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey } as ISashEvent);
|
||||
|
||||
const onStart = mapEvent(sash.onDidStart, sashEventMapper);
|
||||
const onStart = Event.map(sash.onDidStart, sashEventMapper);
|
||||
const onStartDisposable = onStart(this.onSashStart, this);
|
||||
const onChange = mapEvent(sash.onDidChange, sashEventMapper);
|
||||
const onChange = Event.map(sash.onDidChange, sashEventMapper);
|
||||
const onChangeDisposable = onChange(this.onSashChange, this);
|
||||
const onEnd = mapEvent(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash));
|
||||
const onEnd = Event.map(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash));
|
||||
const onEndDisposable = onEnd(this.onSashEnd, this);
|
||||
const onDidResetDisposable = sash.onDidReset(() => this._onDidSashReset.fire(firstIndex(this.sashItems, item => item.sash === sash)));
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
import 'vs/css!./media/selectBox';
|
||||
|
||||
import { SelectBox as vsSelectBox, ISelectBoxStyles as vsISelectBoxStyles, ISelectBoxOptions } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { SelectBox as vsSelectBox, ISelectBoxStyles as vsISelectBoxStyles, ISelectBoxOptions, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { IContextViewProvider, AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
@@ -50,7 +50,7 @@ export class SelectBox extends vsSelectBox {
|
||||
private element: HTMLElement;
|
||||
|
||||
constructor(options: string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement, selectBoxOptions?: ISelectBoxOptions) {
|
||||
super(options, 0, contextViewProvider, undefined, selectBoxOptions);
|
||||
super(options.map(option => { return { text: option }; }), 0, contextViewProvider, undefined, selectBoxOptions);
|
||||
this._optionsDictionary = new Array();
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
this._optionsDictionary[options[i]] = i;
|
||||
@@ -114,13 +114,19 @@ export class SelectBox extends vsSelectBox {
|
||||
}
|
||||
}
|
||||
|
||||
public setOptions(options: string[], selected?: number, disabled?: number): void {
|
||||
this._optionsDictionary = [];
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
this._optionsDictionary[options[i]] = i;
|
||||
public setOptions(options: string[] | ISelectOptionItem[], selected?: number): void {
|
||||
let stringOptions: string[];
|
||||
if (options.length > 0 && typeof options[0] !== 'string') {
|
||||
stringOptions = (options as ISelectOptionItem[]).map(option => option.text);
|
||||
} else {
|
||||
stringOptions = options as string[];
|
||||
}
|
||||
this._dialogOptions = options;
|
||||
super.setOptions(options, selected, disabled);
|
||||
this._optionsDictionary = [];
|
||||
for (var i = 0; i < stringOptions.length; i++) {
|
||||
this._optionsDictionary[stringOptions[i]] = i;
|
||||
}
|
||||
this._dialogOptions = stringOptions;
|
||||
super.setOptions(stringOptions.map(option => { return { text: option }; }), selected);
|
||||
}
|
||||
|
||||
public get value(): string {
|
||||
|
||||
@@ -6,7 +6,6 @@ import { Observable } from 'rxjs/Observable';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { compare as stringCompare } from 'vs/base/common/strings';
|
||||
|
||||
@@ -153,7 +152,7 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
||||
|
||||
find(exp: string, maxMatches: number = 0): Thenable<IFindPosition> {
|
||||
if (!this._findFn) {
|
||||
return TPromise.wrapError(new Error('no find function provided'));
|
||||
return Promise.reject(new Error('no find function provided'));
|
||||
}
|
||||
this._findArray = new Array<IFindPosition>();
|
||||
this._findIndex = 0;
|
||||
@@ -180,7 +179,7 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
||||
return this._findArray[this._findIndex];
|
||||
});
|
||||
} else {
|
||||
return TPromise.wrapError(new Error('no expression'));
|
||||
return Promise.reject(new Error('no expression'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,9 +197,9 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
||||
} else {
|
||||
++this._findIndex;
|
||||
}
|
||||
return TPromise.as(this._findArray[this._findIndex]);
|
||||
return Promise.resolve(this._findArray[this._findIndex]);
|
||||
} else {
|
||||
return TPromise.wrapError(new Error('no search running'));
|
||||
return Promise.reject(new Error('no search running'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,17 +210,17 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
||||
} else {
|
||||
--this._findIndex;
|
||||
}
|
||||
return TPromise.as(this._findArray[this._findIndex]);
|
||||
return Promise.resolve(this._findArray[this._findIndex]);
|
||||
} else {
|
||||
return TPromise.wrapError(new Error('no search running'));
|
||||
return Promise.reject(new Error('no search running'));
|
||||
}
|
||||
}
|
||||
|
||||
get currentFindPosition(): Thenable<IFindPosition> {
|
||||
if (this._findArray && this._findArray.length !== 0) {
|
||||
return TPromise.as(this._findArray[this._findIndex]);
|
||||
return Promise.resolve(this._findArray[this._findIndex]);
|
||||
} else {
|
||||
return TPromise.wrapError(new Error('no search running'));
|
||||
return Promise.reject(new Error('no search running'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
import 'vs/css!vs/base/browser/ui/actionbar/actionbar';
|
||||
|
||||
import { Promise } from 'vs/base/common/winjs.base';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
@@ -363,7 +362,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
|
||||
//this.emit('cancel');
|
||||
}
|
||||
|
||||
public run(action: IAction, context?: any): Promise {
|
||||
public run(action: IAction, context?: any): Promise<any> {
|
||||
return this._actionRunner.run(action, context);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user