Merge from vscode 1fbacccbc900bb59ba8a8f26a4128d48a1c97842

This commit is contained in:
ADS Merger
2020-02-13 02:56:02 +00:00
parent 9af1f3b0eb
commit 73ea8b79b2
229 changed files with 3192 additions and 2103 deletions

View File

@@ -14,7 +14,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { Gesture, EventType } from 'vs/base/browser/touch';
export interface IButtonOptions extends IButtonStyles {
title?: boolean;
title?: boolean | string;
}
export interface IButtonStyles {
@@ -151,10 +151,10 @@ export class Button extends Disposable {
DOM.addClass(this._element, 'monaco-text-button');
}
this._element.textContent = value;
//{{SQL CARBON EDIT}}
this._element.setAttribute('aria-label', value);
//{{END}}
if (this.options.title) {
this._element.setAttribute('aria-label', value); // {{SQL CARBON EDIT}}
if (typeof this.options.title === 'string') {
this._element.title = this.options.title;
} else if (this.options.title) {
this._element.title = value;
}
}

View File

@@ -9,6 +9,7 @@ import { Event } from 'vs/base/common/event';
import { IView, IViewSize } from 'vs/base/browser/ui/grid/grid';
import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { Color } from 'vs/base/common/color';
import { IBoundarySashes } from 'vs/base/browser/ui/grid/gridview';
export interface CenteredViewState {
leftMarginRatio: number;
@@ -72,6 +73,19 @@ export class CenteredViewLayout implements IDisposable {
get maximumHeight(): number { return this.view.maximumHeight; }
get onDidChange(): Event<IViewSize | undefined> { return this.view.onDidChange; }
private _boundarySashes: IBoundarySashes = {};
get boundarySashes(): IBoundarySashes { return this._boundarySashes; }
set boundarySashes(boundarySashes: IBoundarySashes) {
this._boundarySashes = boundarySashes;
if (!this.splitView) {
return;
}
this.splitView.orthogonalStartSash = boundarySashes.top;
this.splitView.orthogonalEndSash = boundarySashes.bottom;
}
layout(width: number, height: number): void {
this.width = width;
this.height = height;
@@ -119,6 +133,8 @@ export class CenteredViewLayout implements IDisposable {
orientation: Orientation.HORIZONTAL,
styles: this.style
});
this.splitView.orthogonalStartSash = this.boundarySashes.top;
this.splitView.orthogonalEndSash = this.boundarySashes.bottom;
this.splitViewDisposables.add(this.splitView.onDidSashChange(() => {
if (this.splitView) {

View File

@@ -5,7 +5,7 @@
@font-face {
font-family: "codicon";
src: url("./codicon.ttf?be537a78617db0869caa4b4cc683a24a") format("truetype");
src: url("./codicon.ttf?6caeeccc06315e827f3bff83885456fb") format("truetype");
}
.codicon[class*='codicon-'] {
@@ -413,4 +413,5 @@
.codicon-feedback:before { content: "\eb96" }
.codicon-group-by-ref-type:before { content: "\eb97" }
.codicon-ungroup-by-ref-type:before { content: "\eb98" }
.codicon-debug-alt:before { content: "\f101" }
.codicon-debug-alt-2:before { content: "\f101" }
.codicon-debug-alt:before { content: "\f102" }

View File

@@ -7,7 +7,7 @@ import 'vs/css!./gridview';
import { Orientation } from 'vs/base/browser/ui/sash/sash';
import { Disposable } from 'vs/base/common/lifecycle';
import { tail2 as tail, equals } from 'vs/base/common/arrays';
import { orthogonal, IView as IGridViewView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize, IGridViewOptions } from './gridview';
import { orthogonal, IView as IGridViewView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize, IGridViewOptions, IBoundarySashes } from './gridview';
import { Event } from 'vs/base/common/event';
export { Orientation, Sizing as GridViewSizing, IViewSize, orthogonal, LayoutPriority } from './gridview';
@@ -212,6 +212,9 @@ export class Grid<T extends IView = IView> extends Disposable {
get maximumHeight(): number { return this.gridview.maximumHeight; }
get onDidChange(): Event<{ width: number; height: number; } | undefined> { return this.gridview.onDidChange; }
get boundarySashes(): IBoundarySashes { return this.gridview.boundarySashes; }
set boundarySashes(boundarySashes: IBoundarySashes) { this.gridview.boundarySashes = boundarySashes; }
get element(): HTMLElement { return this.gridview.element; }
private didLayout = false;

View File

@@ -21,6 +21,20 @@ export interface IViewSize {
readonly height: number;
}
interface IRelativeBoundarySashes {
readonly start?: Sash;
readonly end?: Sash;
readonly orthogonalStart?: Sash;
readonly orthogonalEnd?: Sash;
}
export interface IBoundarySashes {
readonly top?: Sash;
readonly right?: Sash;
readonly bottom?: Sash;
readonly left?: Sash;
}
export interface IView {
readonly element: HTMLElement;
readonly minimumWidth: number;
@@ -32,6 +46,7 @@ export interface IView {
readonly snap?: boolean;
layout(width: number, height: number, top: number, left: number): void;
setVisible?(visible: boolean): void;
setBoundarySashes?(sashes: IBoundarySashes): void;
}
export interface ISerializableView extends IView {
@@ -125,6 +140,22 @@ interface ILayoutContext {
readonly absoluteOrthogonalSize: number;
}
function toAbsoluteBoundarySashes(sashes: IRelativeBoundarySashes, orientation: Orientation): IBoundarySashes {
if (orientation === Orientation.HORIZONTAL) {
return { left: sashes.start, right: sashes.end, top: sashes.orthogonalStart, bottom: sashes.orthogonalEnd };
} else {
return { top: sashes.start, bottom: sashes.end, left: sashes.orthogonalStart, right: sashes.orthogonalEnd };
}
}
function fromAbsoluteBoundarySashes(sashes: IBoundarySashes, orientation: Orientation): IRelativeBoundarySashes {
if (orientation === Orientation.HORIZONTAL) {
return { start: sashes.left, end: sashes.right, orthogonalStart: sashes.top, orthogonalEnd: sashes.bottom };
} else {
return { start: sashes.top, end: sashes.bottom, orthogonalStart: sashes.left, orthogonalEnd: sashes.right };
}
}
class BranchNode implements ISplitView<ILayoutContext>, IDisposable {
readonly element: HTMLElement;
@@ -217,10 +248,27 @@ class BranchNode implements ISplitView<ILayoutContext>, IDisposable {
private splitviewSashResetDisposable: IDisposable = Disposable.None;
private childrenSashResetDisposable: IDisposable = Disposable.None;
get orthogonalStartSash(): Sash | undefined { return this.splitview.orthogonalStartSash; }
set orthogonalStartSash(sash: Sash | undefined) { this.splitview.orthogonalStartSash = sash; }
get orthogonalEndSash(): Sash | undefined { return this.splitview.orthogonalEndSash; }
set orthogonalEndSash(sash: Sash | undefined) { this.splitview.orthogonalEndSash = sash; }
private _boundarySashes: IRelativeBoundarySashes = {};
get boundarySashes(): IRelativeBoundarySashes { return this._boundarySashes; }
set boundarySashes(boundarySashes: IRelativeBoundarySashes) {
this._boundarySashes = boundarySashes;
this.splitview.orthogonalStartSash = boundarySashes.orthogonalStart;
this.splitview.orthogonalEndSash = boundarySashes.orthogonalEnd;
for (let index = 0; index < this.children.length; index++) {
const child = this.children[index];
const first = index === 0;
const last = index === this.children.length - 1;
child.boundarySashes = {
start: boundarySashes.orthogonalStart,
end: boundarySashes.orthogonalEnd,
orthogonalStart: first ? boundarySashes.start : child.boundarySashes.orthogonalStart,
orthogonalEnd: last ? boundarySashes.end : child.boundarySashes.orthogonalEnd,
};
}
}
constructor(
readonly orientation: Orientation,
@@ -260,9 +308,15 @@ class BranchNode implements ISplitView<ILayoutContext>, IDisposable {
this.splitview = new SplitView(this.element, { ...options, descriptor });
this.children.forEach((node, index) => {
// Set up orthogonal sashes for children
node.orthogonalStartSash = this.splitview.sashes[index - 1];
node.orthogonalEndSash = this.splitview.sashes[index];
const first = index === 0;
const last = index === this.children.length;
node.boundarySashes = {
start: this.boundarySashes.orthogonalStart,
end: this.boundarySashes.orthogonalEnd,
orthogonalStart: first ? this.boundarySashes.start : this.splitview.sashes[index - 1],
orthogonalEnd: last ? this.boundarySashes.end : this.splitview.sashes[index],
};
});
}
@@ -335,15 +389,26 @@ class BranchNode implements ISplitView<ILayoutContext>, IDisposable {
const first = index === 0;
const last = index === this.children.length;
this.children.splice(index, 0, node);
node.orthogonalStartSash = this.splitview.sashes[index - 1];
node.orthogonalEndSash = this.splitview.sashes[index];
node.boundarySashes = {
start: this.boundarySashes.orthogonalStart,
end: this.boundarySashes.orthogonalEnd,
orthogonalStart: first ? this.boundarySashes.start : this.splitview.sashes[index - 1],
orthogonalEnd: last ? this.boundarySashes.end : this.splitview.sashes[index],
};
if (!first) {
this.children[index - 1].orthogonalEndSash = this.splitview.sashes[index - 1];
this.children[index - 1].boundarySashes = {
...this.children[index - 1].boundarySashes,
orthogonalEnd: this.splitview.sashes[index - 1]
};
}
if (!last) {
this.children[index + 1].orthogonalStartSash = this.splitview.sashes[index];
this.children[index + 1].boundarySashes = {
...this.children[index + 1].boundarySashes,
orthogonalStart: this.splitview.sashes[index]
};
}
}
@@ -363,11 +428,17 @@ class BranchNode implements ISplitView<ILayoutContext>, IDisposable {
const [child] = this.children.splice(index, 1);
if (!first) {
this.children[index - 1].orthogonalEndSash = this.splitview.sashes[index - 1];
this.children[index - 1].boundarySashes = {
...this.children[index - 1].boundarySashes,
orthogonalEnd: this.splitview.sashes[index - 1]
};
}
if (!last) { // [0,1,2,3] (2) => [0,1,3]
this.children[index].orthogonalStartSash = this.splitview.sashes[Math.max(index - 1, 0)];
this.children[index].boundarySashes = {
...this.children[index].boundarySashes,
orthogonalStart: this.splitview.sashes[Math.max(index - 1, 0)]
};
}
return child;
@@ -408,7 +479,12 @@ class BranchNode implements ISplitView<ILayoutContext>, IDisposable {
to = clamp(to, 0, this.children.length);
this.splitview.swapViews(from, to);
[this.children[from].orthogonalStartSash, this.children[from].orthogonalEndSash, this.children[to].orthogonalStartSash, this.children[to].orthogonalEndSash] = [this.children[to].orthogonalStartSash, this.children[to].orthogonalEndSash, this.children[from].orthogonalStartSash, this.children[from].orthogonalEndSash];
// swap boundary sashes
[this.children[from].boundarySashes, this.children[to].boundarySashes]
= [this.children[from].boundarySashes, this.children[to].boundarySashes];
// swap children
[this.children[from], this.children[to]] = [this.children[to], this.children[from]];
this.onDidChildrenChange();
@@ -655,12 +731,14 @@ class LeafNode implements ISplitView<ILayoutContext>, IDisposable {
return this.orientation === Orientation.HORIZONTAL ? this.maximumWidth : this.maximumHeight;
}
set orthogonalStartSash(sash: Sash) {
// noop
}
private _boundarySashes: IRelativeBoundarySashes = {};
get boundarySashes(): IRelativeBoundarySashes { return this._boundarySashes; }
set boundarySashes(boundarySashes: IRelativeBoundarySashes) {
this._boundarySashes = boundarySashes;
set orthogonalEndSash(sash: Sash) {
// noop
if (this.view.setBoundarySashes) {
this.view.setBoundarySashes(toAbsoluteBoundarySashes(boundarySashes, this.orientation));
}
}
layout(size: number, offset: number, ctx: ILayoutContext | undefined): void {
@@ -764,6 +842,7 @@ export class GridView implements IDisposable {
const { size, orthogonalSize } = this._root;
this.root = flipNode(this._root, orthogonalSize, size);
this.root.layout(size, 0, { orthogonalSize, absoluteOffset: 0, absoluteOrthogonalOffset: 0, absoluteSize: size, absoluteOrthogonalSize: orthogonalSize });
this.boundarySashes = this.boundarySashes;
}
get width(): number { return this.root.width; }
@@ -777,6 +856,13 @@ export class GridView implements IDisposable {
private _onDidChange = new Relay<IViewSize | undefined>();
readonly onDidChange = this._onDidChange.event;
private _boundarySashes: IBoundarySashes = {};
get boundarySashes(): IBoundarySashes { return this._boundarySashes; }
set boundarySashes(boundarySashes: IBoundarySashes) {
this._boundarySashes = boundarySashes;
this.root.boundarySashes = fromAbsoluteBoundarySashes(boundarySashes, this.orientation);
}
/**
* The first layout controller makes sure layout only propagates
* to the views after the very first call to gridview.layout()
@@ -898,6 +984,7 @@ export class GridView implements IDisposable {
// we must promote sibling to be the new root
parent.removeChild(0);
this.root = sibling;
this.boundarySashes = this.boundarySashes;
return node.view;
}

View File

@@ -128,14 +128,14 @@ class AsyncDataTreeRenderer<TInput, T, TFilterData, TTemplateData> implements IT
}
}
function asTreeEvent<TInput, T>(e: ITreeEvent<IAsyncDataTreeNode<TInput, T>>): ITreeEvent<T> {
function asTreeEvent<TInput, T>(e: ITreeEvent<IAsyncDataTreeNode<TInput, T> | null>): ITreeEvent<T> {
return {
browserEvent: e.browserEvent,
elements: e.elements.map(e => e.element as T)
elements: e.elements.map(e => e!.element as T)
};
}
function asTreeMouseEvent<TInput, T>(e: ITreeMouseEvent<IAsyncDataTreeNode<TInput, T>>): ITreeMouseEvent<T> {
function asTreeMouseEvent<TInput, T>(e: ITreeMouseEvent<IAsyncDataTreeNode<TInput, T> | null>): ITreeMouseEvent<T> {
return {
browserEvent: e.browserEvent,
element: e.element && e.element.element as T,
@@ -143,7 +143,7 @@ function asTreeMouseEvent<TInput, T>(e: ITreeMouseEvent<IAsyncDataTreeNode<TInpu
};
}
function asTreeContextMenuEvent<TInput, T>(e: ITreeContextMenuEvent<IAsyncDataTreeNode<TInput, T>>): ITreeContextMenuEvent<T> {
function asTreeContextMenuEvent<TInput, T>(e: ITreeContextMenuEvent<IAsyncDataTreeNode<TInput, T> | null>): ITreeContextMenuEvent<T> {
return {
browserEvent: e.browserEvent,
element: e.element && e.element.element as T,
@@ -793,7 +793,11 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
return result.finally(() => this.refreshPromises.delete(node));
}
private _onDidChangeCollapseState({ node, deep }: ICollapseStateChangeEvent<IAsyncDataTreeNode<TInput, T>, any>): void {
private _onDidChangeCollapseState({ node, deep }: ICollapseStateChangeEvent<IAsyncDataTreeNode<TInput, T> | null, any>): void {
if (node.element === null) {
return;
}
if (!node.collapsed && node.element.stale) {
if (deep) {
this.collapse(node.element.element as T);

View File

@@ -37,7 +37,7 @@ export class DataTree<TInput, T, TFilterData = void> extends AbstractTree<T | nu
private dataSource: IDataSource<TInput, T>,
options: IDataTreeOptions<T, TFilterData> = {}
) {
super(user, container, delegate, renderers, options);
super(user, container, delegate, renderers, options as IDataTreeOptions<T | null, TFilterData>);
this.identityProvider = options.identityProvider;
}
@@ -182,7 +182,7 @@ export class DataTree<TInput, T, TFilterData = void> extends AbstractTree<T | nu
throw new TreeError(this.user, 'Can\'t get tree view state without an identity provider');
}
const getId = (element: T) => this.identityProvider!.getId(element).toString();
const getId = (element: T | null) => this.identityProvider!.getId(element!).toString();
const focus = this.getFocus().map(getId);
const selection = this.getSelection().map(getId);

View File

@@ -30,7 +30,7 @@ export class ObjectTree<T extends NonNullable<any>, TFilterData = void> extends
renderers: ITreeRenderer<T, TFilterData, any>[],
options: IObjectTreeOptions<T, TFilterData> = {}
) {
super(user, container, delegate, renderers, options);
super(user, container, delegate, renderers, options as IObjectTreeOptions<T | null, TFilterData>);
}
setChildren(element: T | null, children?: ISequence<ITreeElement<T>>): void {
@@ -181,7 +181,7 @@ export class CompressibleObjectTree<T extends NonNullable<any>, TFilterData = vo
) {
const compressedTreeNodeProvider = () => this;
const compressibleRenderers = renderers.map(r => new CompressibleRenderer<T, TFilterData, any>(compressedTreeNodeProvider, r));
super(user, container, delegate, compressibleRenderers, asObjectTreeOptions(compressedTreeNodeProvider, options));
super(user, container, delegate, compressibleRenderers, asObjectTreeOptions<T, TFilterData>(compressedTreeNodeProvider, options));
}
setChildren(element: T | null, children?: ISequence<ICompressedTreeElement<T>>): void {

View File

@@ -79,35 +79,47 @@ export class ObjectTreeModel<T extends NonNullable<any>, TFilterData extends Non
const insertedElements = new Set<T | null>();
const insertedElementIds = new Set<string>();
const _onDidCreateNode = (node: ITreeNode<T, TFilterData>) => {
insertedElements.add(node.element);
this.nodes.set(node.element, node);
const _onDidCreateNode = (node: ITreeNode<T | null, TFilterData>) => {
if (node.element === null) {
return;
}
const tnode = node as ITreeNode<T, TFilterData>;
insertedElements.add(tnode.element);
this.nodes.set(tnode.element, tnode);
if (this.identityProvider) {
const id = this.identityProvider.getId(node.element).toString();
const id = this.identityProvider.getId(tnode.element).toString();
insertedElementIds.add(id);
this.nodesByIdentity.set(id, node);
this.nodesByIdentity.set(id, tnode);
}
if (onDidCreateNode) {
onDidCreateNode(node);
onDidCreateNode(tnode);
}
};
const _onDidDeleteNode = (node: ITreeNode<T, TFilterData>) => {
if (!insertedElements.has(node.element)) {
this.nodes.delete(node.element);
const _onDidDeleteNode = (node: ITreeNode<T | null, TFilterData>) => {
if (node.element === null) {
return;
}
const tnode = node as ITreeNode<T, TFilterData>;
if (!insertedElements.has(tnode.element)) {
this.nodes.delete(tnode.element);
}
if (this.identityProvider) {
const id = this.identityProvider.getId(node.element).toString();
const id = this.identityProvider.getId(tnode.element).toString();
if (!insertedElementIds.has(id)) {
this.nodesByIdentity.delete(id);
}
}
if (onDidDeleteNode) {
onDidDeleteNode(node);
onDidDeleteNode(tnode);
}
};