Merge VS Code 1.31.1 (#4283)

This commit is contained in:
Matt Irvine
2019-03-15 13:09:45 -07:00
committed by GitHub
parent 7d31575149
commit 86bac90001
1716 changed files with 53308 additions and 48375 deletions

View File

@@ -6,7 +6,7 @@
import 'vs/css!sql/media/actionBarLabel';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { localize } from 'vs/nls';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -89,4 +89,13 @@ if (process.env.NODE_ENV !== 'development') {
}
}
});
}
}
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
group: '3_views',
command: {
id: VIEWLET_ID,
title: localize({ key: 'miViewRegisteredServers', comment: ['&& denotes a mnemonic'] }, "&&Servers")
},
order: 1
});

View File

@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
@@ -43,7 +42,7 @@ export class RefreshAction extends Action {
super(id, label);
this._tree = tree;
}
public run(): TPromise<boolean> {
public run(): Promise<boolean> {
var treeNode: TreeNode;
if (this.element instanceof ConnectionProfile) {
let connection: ConnectionProfile = this.element;
@@ -60,23 +59,23 @@ export class RefreshAction extends Action {
}
if (treeNode) {
this._tree.collapse(this.element).then(() => {
this._objectExplorerService.refreshTreeNode(treeNode.getSession(), treeNode).then(() => {
return this._tree.collapse(this.element).then(() => {
return this._objectExplorerService.refreshTreeNode(treeNode.getSession(), treeNode).then(() => {
this._tree.refresh(this.element).then(() => {
this._tree.expand(this.element);
return this._tree.refresh(this.element).then(() => {
return this._tree.expand(this.element);
}, refreshError => {
return TPromise.as(true);
return Promise.resolve(true);
});
}, error => {
this.showError(error);
return TPromise.as(true);
return Promise.resolve(true);
});
}, collapseError => {
return TPromise.as(true);
return Promise.resolve(true);
});
}
return TPromise.as(true);
return Promise.resolve(true);
}
private showError(errorMessage: string) {
@@ -101,8 +100,8 @@ export class DisconnectConnectionAction extends Action {
super(id, label);
}
run(actionContext: ObjectExplorerActionsContext): TPromise<any> {
return new TPromise<boolean>((resolve, reject) => {
run(actionContext: ObjectExplorerActionsContext): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
if (!this._connectionProfile) {
resolve(true);
}
@@ -143,7 +142,7 @@ export class AddServerAction extends Action {
this.class = 'add-server-action';
}
public run(element: ConnectionProfileGroup): TPromise<boolean> {
public run(element: ConnectionProfileGroup): Promise<boolean> {
let connection: IConnectionProfile = element === undefined ? undefined : {
connectionName: undefined,
serverName: undefined,
@@ -162,7 +161,7 @@ export class AddServerAction extends Action {
id: element.id
};
this._connectionManagementService.showConnectionDialog(undefined, connection);
return TPromise.as(true);
return Promise.resolve(true);
}
}
@@ -182,9 +181,9 @@ export class AddServerGroupAction extends Action {
this.class = 'add-server-group-action';
}
public run(): TPromise<boolean> {
public run(): Promise<boolean> {
this._connectionManagementService.showCreateServerGroupDialog();
return TPromise.as(true);
return Promise.resolve(true);
}
}
@@ -205,9 +204,9 @@ export class EditServerGroupAction extends Action {
this.class = 'edit-server-group-action';
}
public run(): TPromise<boolean> {
public run(): Promise<boolean> {
this._connectionManagementService.showEditServerGroupDialog(this._group);
return TPromise.as(true);
return Promise.resolve(true);
}
}
@@ -241,10 +240,10 @@ export class ActiveConnectionsFilterAction extends Action {
this.class = ActiveConnectionsFilterAction.enabledClass;
}
public run(): TPromise<boolean> {
public run(): Promise<boolean> {
if (!this.view) {
// return without doing anything
return TPromise.as(true);
return Promise.resolve(true);
}
if (this.class === ActiveConnectionsFilterAction.enabledClass) {
// show active connections in the tree
@@ -257,7 +256,7 @@ export class ActiveConnectionsFilterAction extends Action {
this.isSet = false;
this.label = ActiveConnectionsFilterAction.LABEL;
}
return TPromise.as(true);
return Promise.resolve(true);
}
}
@@ -289,10 +288,10 @@ export class RecentConnectionsFilterAction extends Action {
this._isSet = false;
}
public run(): TPromise<boolean> {
public run(): Promise<boolean> {
if (!this.view) {
// return without doing anything
return TPromise.as(true);
return Promise.resolve(true);
}
if (this.class === RecentConnectionsFilterAction.enabledClass) {
// show recent connections in the tree
@@ -303,7 +302,7 @@ export class RecentConnectionsFilterAction extends Action {
this.view.refreshTree();
this.isSet = false;
}
return TPromise.as(true);
return Promise.resolve(true);
}
}
@@ -331,13 +330,13 @@ export class NewQueryAction extends Action {
this.class = 'extension-action update';
}
public run(actionContext: ObjectExplorerActionsContext): TPromise<boolean> {
public run(actionContext: ObjectExplorerActionsContext): Promise<boolean> {
if (actionContext instanceof ObjectExplorerActionsContext) {
this._connectionProfile = new ConnectionProfile(this._capabilitiesService, actionContext.connectionProfile);
}
TaskUtilities.newQuery(this._connectionProfile, this.connectionManagementService, this.queryEditorService, this._objectExplorerService, this._workbenchEditorService);
return TPromise.as(true);
return Promise.resolve(true);
}
}
@@ -369,13 +368,13 @@ export class DeleteConnectionAction extends Action {
}
}
public run(): TPromise<boolean> {
public run(): Promise<boolean> {
if (this.element instanceof ConnectionProfile) {
this._connectionManagementService.deleteConnection(this.element);
} else if (this.element instanceof ConnectionProfileGroup) {
this._connectionManagementService.deleteConnectionGroup(this.element);
}
return TPromise.as(true);
return Promise.resolve(true);
}
}
@@ -397,8 +396,8 @@ export class ClearSearchAction extends Action {
this.enabled = false;
}
public run(): TPromise<boolean> {
public run(): Promise<boolean> {
this._viewlet.clearSearch();
return TPromise.as(true);
return Promise.resolve(true);
}
}

View File

@@ -8,10 +8,11 @@ import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectio
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import { ITree, IDragAndDrop, IDragAndDropData, IDragOverReaction, DRAG_OVER_ACCEPT_BUBBLE_DOWN, DRAG_OVER_REJECT } from 'vs/base/parts/tree/browser/tree';
import { ITree, IDragAndDrop, IDragOverReaction, DRAG_OVER_ACCEPT_BUBBLE_DOWN, DRAG_OVER_REJECT } from 'vs/base/parts/tree/browser/tree';
import * as Constants from 'sql/platform/connection/common/constants';
import { DragMouseEvent } from 'vs/base/browser/mouseEvent';
import { TreeUpdateUtils } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
import { IDragAndDropData } from 'vs/base/browser/dnd';
/**
* Implements drag and drop for the server tree

View File

@@ -5,7 +5,6 @@
'use strict';
import { localize } from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import { ITree } from 'vs/base/parts/tree/browser/tree';
import { ExecuteCommandAction } from 'vs/platform/actions/common/actions';
@@ -38,7 +37,7 @@ export class ObjectExplorerActionsContext implements azdata.ObjectExplorerContex
public isConnectionNode: boolean = false;
}
async function getTreeNode(context: ObjectExplorerActionsContext, objectExplorerService: IObjectExplorerService): TPromise<TreeNode> {
async function getTreeNode(context: ObjectExplorerActionsContext, objectExplorerService: IObjectExplorerService): Promise<TreeNode> {
if (context.isConnectionNode) {
return Promise.resolve(undefined);
}
@@ -100,11 +99,11 @@ export class ManageConnectionAction extends Action {
super(id, label);
}
run(actionContext: ObjectExplorerActionsContext): TPromise<any> {
run(actionContext: ObjectExplorerActionsContext): Promise<any> {
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
this._treeSelectionHandler.onTreeActionStateChange(true);
let self = this;
let promise = new TPromise<boolean>((resolve, reject) => {
let promise = new Promise<boolean>((resolve, reject) => {
self.doManage(actionContext).then((success) => {
self.done();
resolve(success);
@@ -116,7 +115,7 @@ export class ManageConnectionAction extends Action {
return promise;
}
private async doManage(actionContext: ObjectExplorerActionsContext): TPromise<boolean> {
private async doManage(actionContext: ObjectExplorerActionsContext): Promise<boolean> {
let treeNode: TreeNode = undefined;
let connectionProfile: IConnectionProfile = undefined;
if (actionContext instanceof ObjectExplorerActionsContext) {

View File

@@ -7,7 +7,6 @@
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { ITree, IDataSource } from 'vs/base/parts/tree/browser/tree';
import { TPromise } from 'vs/base/common/winjs.base';
/**
* Implements the DataSource(that returns a parent/children of an element) for the recent connection tree
@@ -43,26 +42,26 @@ export class RecentConnectionDataSource implements IDataSource {
/**
* Returns the element's children as an array in a promise.
*/
public getChildren(tree: ITree, element: any): TPromise<any> {
public getChildren(tree: ITree, element: any): Promise<any> {
if (element instanceof ConnectionProfile) {
return TPromise.as(null);
return Promise.resolve(null);
} else if (element instanceof ConnectionProfileGroup) {
return TPromise.as((<ConnectionProfileGroup>element).getChildren());
return Promise.resolve((<ConnectionProfileGroup>element).getChildren());
} else {
return TPromise.as(null);
return Promise.resolve(null);
}
}
/**
* Returns the element's parent in a promise.
*/
public getParent(tree: ITree, element: any): TPromise<any> {
public getParent(tree: ITree, element: any): Promise<any> {
if (element instanceof ConnectionProfile) {
return TPromise.as((<ConnectionProfile>element).getParent());
return Promise.resolve((<ConnectionProfile>element).getParent());
} else if (element instanceof ConnectionProfileGroup) {
return TPromise.as((<ConnectionProfileGroup>element).getParent());
return Promise.resolve((<ConnectionProfileGroup>element).getParent());
} else {
return TPromise.as(null);
return Promise.resolve(null);
}
}
}

View File

@@ -4,8 +4,6 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import { TPromise } from 'vs/base/common/winjs.base';
import { ITree } from 'vs/base/parts/tree/browser/tree';
import { ContributableActionProvider } from 'vs/workbench/browser/actions';
import { IAction } from 'vs/base/common/actions';

View File

@@ -9,7 +9,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
import { ITree, IDataSource } from 'vs/base/parts/tree/browser/tree';
import { TreeNode, TreeItemCollapsibleState } from 'sql/parts/objectExplorer/common/treeNode';
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
import { TPromise } from 'vs/base/common/winjs.base';
import { TreeUpdateUtils } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import Severity from 'vs/base/common/severity';
@@ -58,8 +57,8 @@ export class ServerTreeDataSource implements IDataSource {
/**
* Returns the element's children as an array in a promise.
*/
public getChildren(tree: ITree, element: any): TPromise<any> {
return new TPromise<any>((resolve) => {
public getChildren(tree: ITree, element: any): Promise<any> {
return new Promise<any>((resolve) => {
if (element instanceof ConnectionProfile) {
TreeUpdateUtils.getObjectExplorerNode(<ConnectionProfile>element, this._connectionManagementService, this._objectExplorerService).then(nodes => {
resolve(nodes);
@@ -93,15 +92,15 @@ export class ServerTreeDataSource implements IDataSource {
/**
* Returns the element's parent in a promise.
*/
public getParent(tree: ITree, element: any): TPromise<any> {
public getParent(tree: ITree, element: any): Promise<any> {
if (element instanceof ConnectionProfile) {
return TPromise.as(element.getParent());
return Promise.resolve(element.getParent());
} else if (element instanceof ConnectionProfileGroup) {
return TPromise.as(element.getParent());
return Promise.resolve(element.getParent());
} else if (element instanceof TreeNode) {
return TPromise.as(TreeUpdateUtils.getObjectExplorerParent(element, this._connectionManagementService));
return Promise.resolve(TreeUpdateUtils.getObjectExplorerParent(element, this._connectionManagementService));
} else {
return TPromise.as(null);
return Promise.resolve(null);
}
}

View File

@@ -172,7 +172,7 @@ export class ServerTreeView {
return uri && uri.startsWith(ConnectionUtils.uriPrefixes.default) && !isBackupRestoreUri;
}
private handleAddConnectionProfile(newProfile: IConnectionProfile) {
private async handleAddConnectionProfile(newProfile: IConnectionProfile): Promise<void> {
if (newProfile) {
let groups = this._connectionManagementService.getConnectionGroups();
let profile = ConnectionUtils.findProfileInGroup(newProfile, groups);
@@ -191,7 +191,7 @@ export class ServerTreeView {
if (newProfile && currentSelectedElement && !newProfileIsSelected) {
this._tree.clearSelection();
}
this.refreshTree();
await this.refreshTree();
if (newProfile && !newProfileIsSelected) {
this._tree.reveal(newProfile);
this._tree.select(newProfile);
@@ -256,10 +256,10 @@ export class ServerTreeView {
return Promise.resolve();
}
public refreshTree(): void {
public refreshTree(): Promise<void> {
this.messages.hide();
this.clearOtherActions();
TreeUpdateUtils.registeredServerUpdate(this._tree, this._connectionManagementService);
return TreeUpdateUtils.registeredServerUpdate(this._tree, this._connectionManagementService);
}
public refreshElement(element: any): Thenable<void> {

View File

@@ -10,7 +10,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
import { NodeType } from 'sql/parts/objectExplorer/common/nodeType';
import { TPromise } from 'vs/base/common/winjs.base';
import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode';
import errors = require('vs/base/common/errors');
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
@@ -22,7 +21,7 @@ export class TreeUpdateUtils {
/**
* Set input for the tree.
*/
public static structuralTreeUpdate(tree: ITree, viewKey: string, connectionManagementService: IConnectionManagementService, providers?: string[]): Thenable<void> {
public static structuralTreeUpdate(tree: ITree, viewKey: string, connectionManagementService: IConnectionManagementService, providers?: string[]): Promise<void> {
let selectedElement: any;
let targetsToExpand: any[];
if (tree) {
@@ -59,7 +58,7 @@ export class TreeUpdateUtils {
/**
* Set input for the registered servers tree.
*/
public static registeredServerUpdate(tree: ITree, connectionManagementService: IConnectionManagementService, elementToSelect?: any): void {
public static registeredServerUpdate(tree: ITree, connectionManagementService: IConnectionManagementService, elementToSelect?: any): Promise<void> {
let selectedElement: any = elementToSelect;
let targetsToExpand: any[];
@@ -82,7 +81,7 @@ export class TreeUpdateUtils {
let treeInput = TreeUpdateUtils.getTreeInput(connectionManagementService);
if (treeInput) {
if (treeInput !== tree.getInput()) {
tree.setInput(treeInput).then(() => {
return tree.setInput(treeInput).then(() => {
// Make sure to expand all folders that where expanded in the previous session
if (targetsToExpand) {
tree.expandAll(targetsToExpand);
@@ -94,6 +93,7 @@ export class TreeUpdateUtils {
}, errors.onUnexpectedError);
}
}
return Promise.resolve();
}
public static getTreeInput(connectionManagementService: IConnectionManagementService, providers?: string[]): ConnectionProfileGroup {
@@ -117,8 +117,8 @@ export class TreeUpdateUtils {
connection: IConnectionProfile,
options: IConnectionCompletionOptions,
connectionManagementService: IConnectionManagementService,
tree: ITree): TPromise<ConnectionProfile> {
return new TPromise<ConnectionProfile>((resolve, reject) => {
tree: ITree): Promise<ConnectionProfile> {
return new Promise<ConnectionProfile>((resolve, reject) => {
if (!connectionManagementService.isProfileConnected(connection)) {
// don't try to reconnect if currently connecting
if (connectionManagementService.isProfileConnecting(connection)) {
@@ -176,8 +176,8 @@ export class TreeUpdateUtils {
* @param objectExplorerService Object explorer service instance
*/
public static connectAndCreateOeSession(connection: IConnectionProfile, options: IConnectionCompletionOptions,
connectionManagementService: IConnectionManagementService, objectExplorerService: IObjectExplorerService, tree: ITree): TPromise<boolean> {
return new TPromise<boolean>((resolve, reject) => {
connectionManagementService: IConnectionManagementService, objectExplorerService: IObjectExplorerService, tree: ITree): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
TreeUpdateUtils.connectIfNotConnected(connection, options, connectionManagementService, tree).then(connectedConnection => {
if (connectedConnection) {
// append group ID and original display name to build unique OE session ID
@@ -205,8 +205,8 @@ export class TreeUpdateUtils {
});
}
public static getObjectExplorerNode(connection: ConnectionProfile, connectionManagementService: IConnectionManagementService, objectExplorerService: IObjectExplorerService): TPromise<TreeNode[]> {
return new TPromise<TreeNode[]>((resolve, reject) => {
public static getObjectExplorerNode(connection: ConnectionProfile, connectionManagementService: IConnectionManagementService, objectExplorerService: IObjectExplorerService): Promise<TreeNode[]> {
return new Promise<TreeNode[]>((resolve, reject) => {
if (connection.isDisconnecting) {
resolve([]);
} else {