Merge from vscode 2b0b9136329c181a9e381463a1f7dc3a2d105a34 (#4880)

This commit is contained in:
Karl Burtram
2019-04-05 10:09:18 -07:00
committed by GitHub
parent 9bd7e30d18
commit cb5bcf2248
433 changed files with 8915 additions and 8361 deletions

View File

@@ -233,7 +233,7 @@ export class Dropdown extends Disposable {
this._layoutTree();
return { dispose: () => { } };
},
onDOMEvent: e => {
onDOMEvent: (e: any) => {
if (!DOM.isAncestor(e.srcElement, this.$el.getHTMLElement()) && !DOM.isAncestor(e.srcElement, this.$treeContainer.getHTMLElement())) {
this._input.validate();
this._onBlur.fire();

View File

@@ -23,8 +23,9 @@ import { ComponentBase } from 'sql/parts/modelComponents/componentBase';
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/parts/modelComponents/interfaces';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { WebviewElement, WebviewOptions, WebviewContentOptions } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
import { WebviewElement } from 'vs/workbench/contrib/webview/electron-browser/webviewElement';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { WebviewContentOptions } from 'vs/workbench/contrib/webview/common/webview';
function reviveWebviewOptions(options: vscode.WebviewOptions): vscode.WebviewOptions {
return {

View File

@@ -164,7 +164,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
//Saves scrollTop value on scroll change
public scrollHandler(event: Event){
this._scrollTop = event.srcElement.scrollTop;
this._scrollTop = (<any>event.srcElement).scrollTop;
}
public unselectActiveCell() {

View File

@@ -14,6 +14,34 @@ import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode';
import errors = require('vs/base/common/errors');
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
export interface IExpandableTree extends ITree {
// {{SQL CARBON EDIT }} - add back deleted VS Code tree methods
/**
* Returns a list of the currently expanded elements.
*/
getExpandedElements(): any[];
/**
* Returns a number between 0 and 1 representing how much the tree is scroll down. 0 means all the way
* to the top; 1 means all the way down.
*/
getScrollPosition(): number;
/**
* Sets the scroll position with a number between 0 and 1 representing how much the tree is scroll down. 0 means all the way
* to the top; 1 means all the way down.
*/
setScrollPosition(pos: number): void;
/**
* Returns the total height of the tree's content.
*/
getContentHeight(): number;
// {{SQL CARBON EDIT }} - end block
}
export class TreeUpdateUtils {
public static isInDragAndDrop: boolean = false;
@@ -22,6 +50,9 @@ export class TreeUpdateUtils {
* Set input for the tree.
*/
public static structuralTreeUpdate(tree: ITree, viewKey: string, connectionManagementService: IConnectionManagementService, providers?: string[]): Promise<void> {
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>tree;
let selectedElement: any;
let targetsToExpand: any[];
if (tree) {
@@ -29,7 +60,7 @@ export class TreeUpdateUtils {
if (selection && selection.length === 1) {
selectedElement = <any>selection[0];
}
targetsToExpand = tree.getExpandedElements();
targetsToExpand = expandableTree.getExpandedElements();
}
let groups;
let treeInput = new ConnectionProfileGroup('root', null, undefined, undefined, undefined);
@@ -59,6 +90,9 @@ export class TreeUpdateUtils {
* Set input for the registered servers tree.
*/
public static registeredServerUpdate(tree: ITree, connectionManagementService: IConnectionManagementService, elementToSelect?: any): Promise<void> {
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>tree;
let selectedElement: any = elementToSelect;
let targetsToExpand: any[];
@@ -72,7 +106,7 @@ export class TreeUpdateUtils {
selectedElement = <any>selection[0];
}
}
targetsToExpand = tree.getExpandedElements();
targetsToExpand = expandableTree.getExpandedElements();
if (selectedElement && targetsToExpand.indexOf(selectedElement) === -1) {
targetsToExpand.push(selectedElement);
}

View File

@@ -30,6 +30,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IExpandableTree } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
export interface IResultMessageIntern extends IResultMessage {
id?: string;
@@ -109,8 +110,11 @@ export class MessagePanel extends ViewletPanel {
}, { keyboardSupport: false, horizontalScrollMode: ScrollbarVisibility.Auto });
this.disposables.push(this.tree);
this.tree.onDidScroll(e => {
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>this.tree;
if (this.state) {
this.state.scrollPosition = this.tree.getScrollPosition();
this.state.scrollPosition = expandableTree.getScrollPosition();
}
});
this.onDidChange(e => {
@@ -178,13 +182,16 @@ export class MessagePanel extends ViewletPanel {
}
protected layoutBody(size: number): void {
const previousScrollPosition = this.tree.getScrollPosition();
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>this.tree;
const previousScrollPosition = expandableTree.getScrollPosition();
this.tree.layout(size);
if (this.state && this.state.scrollPosition) {
this.tree.setScrollPosition(this.state.scrollPosition);
expandableTree.setScrollPosition(this.state.scrollPosition);
} else {
if (previousScrollPosition === 1) {
this.tree.setScrollPosition(1);
expandableTree.setScrollPosition(1);
}
}
}
@@ -214,17 +221,19 @@ export class MessagePanel extends ViewletPanel {
if (hasError) {
this.setExpanded(true);
}
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>this.tree;
if (this.state.scrollPosition) {
this.tree.refresh(this.model).then(() => {
// Restore the previous scroll position when switching between tabs
this.tree.setScrollPosition(this.state.scrollPosition);
expandableTree.setScrollPosition(this.state.scrollPosition);
});
} else {
const previousScrollPosition = this.tree.getScrollPosition();
const previousScrollPosition = expandableTree.getScrollPosition();
this.tree.refresh(this.model).then(() => {
// Scroll to the end if the user was already at the end otherwise leave the current scroll position
if (previousScrollPosition === 1) {
this.tree.setScrollPosition(1);
expandableTree.setScrollPosition(1);
}
});
}
@@ -244,8 +253,10 @@ export class MessagePanel extends ViewletPanel {
public set state(val: MessagePanelState) {
this._state = val;
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>this.tree;
if (this.state.scrollPosition) {
this.tree.setScrollPosition(this.state.scrollPosition);
expandableTree.setScrollPosition(this.state.scrollPosition);
}
this.setExpanded(!this.state.collapsed);
}

View File

@@ -14,6 +14,7 @@ import { ITree } from 'vs/base/parts/tree/browser/tree';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { DefaultFilter, DefaultDragAndDrop, DefaultAccessibilityProvider } from 'vs/base/parts/tree/browser/treeDefaults';
import { localize } from 'vs/nls';
import { hide, $, append } from 'vs/base/browser/dom';
import { TaskHistoryRenderer } from 'sql/parts/taskHistory/viewlet/taskHistoryRenderer';
import { TaskHistoryDataSource } from 'sql/parts/taskHistory/viewlet/taskHistoryDataSource';
@@ -22,7 +23,7 @@ import { TaskHistoryActionProvider } from 'sql/parts/taskHistory/viewlet/taskHis
import { ITaskService } from 'sql/platform/taskHistory/common/taskService';
import { TaskNode, TaskStatus } from 'sql/parts/taskHistory/common/taskNode';
import { IErrorMessageService } from 'sql/platform/errorMessage/common/errorMessageService';
import { hide, $, append } from 'vs/base/browser/dom';
import { IExpandableTree } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
/**
* TaskHistoryView implements the dynamic tree view.
@@ -112,7 +113,9 @@ export class TaskHistoryView {
if (selection && selection.length === 1) {
selectedElement = <any>selection[0];
}
targetsToExpand = this._tree.getExpandedElements();
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>this._tree;
targetsToExpand = expandableTree.getExpandedElements();
}
//Get the tree Input

View File

@@ -12,7 +12,7 @@ import { Modal } from 'sql/workbench/browser/modal/modal';
import { IConnectionManagementService, INewConnectionParams } from 'sql/platform/connection/common/connectionManagement';
import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper';
import { TreeCreationUtils } from 'sql/parts/objectExplorer/viewlet/treeCreationUtils';
import { TreeUpdateUtils } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
import { TreeUpdateUtils, IExpandableTree } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { TabbedPanel, PanelTabIdentifier } from 'sql/base/browser/ui/panel/panel';
import { RecentConnectionTreeController, RecentConnectionActionsProvider } from 'sql/parts/connection/connectionDialog/recentConnectionTreeController';
@@ -178,11 +178,14 @@ export class ConnectionDialogWidget extends Modal {
});
this._panel.onTabChange(async c => {
if (c === savedConnectionTabId && this._savedConnectionTree.getContentHeight() === 0) {
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>this._savedConnectionTree;
if (c === savedConnectionTabId && expandableTree.getContentHeight() === 0) {
// Update saved connection tree
await TreeUpdateUtils.structuralTreeUpdate(this._savedConnectionTree, 'saved', this._connectionManagementService, this._providers);
if (this._savedConnectionTree.getContentHeight() > 0) {
if (expandableTree.getContentHeight() > 0) {
this._noSavedConnectionBuilder.hide();
this._savedConnectionBuilder.show();
} else {

View File

@@ -18,6 +18,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { attachListStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ITree } from 'vs/base/parts/tree/browser/tree';
import { IExpandableTree } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
/**
* Implements tree view for file browser
@@ -96,7 +97,9 @@ export class FileBrowserTreeView implements IDisposable {
if (selection && selection.length === 1) {
selectedElement = <any>selection[0];
}
targetsToExpand = this._tree.getExpandedElements();
// convert to old VS Code tree interface with expandable methods
let expandableTree: IExpandableTree = <IExpandableTree>this._tree;
targetsToExpand = expandableTree.getExpandedElements();
}
if (rootNode) {