Skip to content

Commit

Permalink
Merge from vscode ec07311 (microsoft#6739)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Dresser authored Aug 14, 2019
1 parent a645a09 commit 82c1c57
Show file tree
Hide file tree
Showing 77 changed files with 1,320 additions and 742 deletions.
9 changes: 9 additions & 0 deletions extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,15 @@
"scope": "resource",
"default": false,
"description": "%config.supportCancellation%"
},
"git.branchSortOrder": {
"type": "string",
"enum": [
"committerdate",
"alphabetically"
],
"default": "committerdate",
"description": "%config.branchSortOrder%"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions extensions/git/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"config.confirmForcePush": "Controls whether to ask for confirmation before force-pushing.",
"config.openDiffOnClick": "Controls whether the diff editor should be opened when clicking a change. Otherwise the regular editor will be opened.",
"config.supportCancellation": "Controls whether a notification comes up when running the Sync action, which allows the user to cancel the operation.",
"config.branchSortOrder": "Controls the sort order for branches.",
"colors.added": "Color for added resources.",
"colors.modified": "Color for modified resources.",
"colors.deleted": "Color for deleted resources.",
Expand Down
10 changes: 8 additions & 2 deletions extensions/git/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1624,8 +1624,14 @@ export class Repository {
.map(([ref]) => ({ name: ref, type: RefType.Head } as Branch));
}

async getRefs(): Promise<Ref[]> {
const result = await this.run(['for-each-ref', '--format', '%(refname) %(objectname)', '--sort', '-committerdate']);
async getRefs(opts?: { sort?: 'alphabetically' | 'committerdate' }): Promise<Ref[]> {
const args = ['for-each-ref', '--format', '%(refname) %(objectname)'];

if (opts && opts.sort && opts.sort !== 'alphabetically') {
args.push('--sort', opts.sort);
}

const result = await this.run(args);

const fn = (line: string): Ref | null => {
let match: RegExpExecArray | null;
Expand Down
7 changes: 5 additions & 2 deletions extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,9 @@ export class Repository implements Disposable {
onConfigListener(updateIndexGroupVisibility, this, this.disposables);
updateIndexGroupVisibility();

const onConfigListenerForBranchSortOrder = filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.branchSortOrder', root));
onConfigListenerForBranchSortOrder(this.updateModelState, this, this.disposables);

this.mergeGroup.hideWhenEmpty = true;

this.disposables.push(this.mergeGroup);
Expand Down Expand Up @@ -1405,7 +1408,6 @@ export class Repository implements Disposable {
const config = workspace.getConfiguration('git');
const shouldIgnore = config.get<boolean>('ignoreLimitWarning') === true;
const useIcons = !config.get<boolean>('decorations.enabled', true);

this.isRepositoryHuge = didHitLimit;

if (didHitLimit && !shouldIgnore && !this.didWarnAboutLimit) {
Expand Down Expand Up @@ -1455,7 +1457,8 @@ export class Repository implements Disposable {
// noop
}

const [refs, remotes, submodules, rebaseCommit] = await Promise.all([this.repository.getRefs(), this.repository.getRemotes(), this.repository.getSubmodules(), this.getRebaseCommit()]);
const sort = config.get<'alphabetically' | 'committerdate'>('branchSortOrder') || 'alphabetically';
const [refs, remotes, submodules, rebaseCommit] = await Promise.all([this.repository.getRefs({ sort }), this.repository.getRemotes(), this.repository.getSubmodules(), this.getRebaseCommit()]);

this._HEAD = HEAD;
this._refs = refs;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"vscode-ripgrep": "^1.5.6",
"vscode-sqlite3": "4.0.8",
"vscode-textmate": "^4.2.2",
"xterm": "3.15.0-beta98",
"xterm": "3.15.0-beta99",
"xterm-addon-search": "0.2.0-beta3",
"xterm-addon-web-links": "0.1.0-beta10",
"yauzl": "^2.9.2",
Expand Down
2 changes: 1 addition & 1 deletion remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"vscode-proxy-agent": "0.4.0",
"vscode-ripgrep": "^1.5.6",
"vscode-textmate": "^4.2.2",
"xterm": "3.15.0-beta98",
"xterm": "3.15.0-beta99",
"xterm-addon-search": "0.2.0-beta3",
"xterm-addon-web-links": "0.1.0-beta10",
"yauzl": "^2.9.2",
Expand Down
3 changes: 0 additions & 3 deletions remote/web/.yarnrc

This file was deleted.

8 changes: 4 additions & 4 deletions remote/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1227,10 +1227,10 @@ xterm-addon-web-links@0.1.0-beta10:
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.1.0-beta10.tgz#610fa9773a2a5ccd41c1c83ba0e2dd2c9eb66a23"
integrity sha512-xfpjy0V6bB4BR44qIgZQPoCMVakxb65gMscPkHpO//QxvUxKzabV3dxOsIbeZRFkUGsWTFlvz2OoaBLoNtv5gg==

xterm@3.15.0-beta98:
version "3.15.0-beta98"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta98.tgz#37f37c35577422880e7ef673cc37f9d2a45dd40c"
integrity sha512-vZbg2LcRvoiJOgr1MyeLFM9mF4uib3BWUWDHyFc+vZ58CTuK0iczOvFXgk/ySo23ZLqwmHQSigLgmWvZ8J5G0Q==
xterm@3.15.0-beta99:
version "3.15.0-beta99"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.15.0-beta99.tgz#0010a7ea5d56cbb08a1e3a525b353c96a158e7a0"
integrity sha512-Vm0ZWToWwO4uk/28Kqvqt9L92h5EU2z4WR9I6xcQaPIBmkJPINIARU4LWQnvaOfgFhRbpwBMveTfh8/jM97lPg==

yauzl@^2.9.2:
version "2.10.0"
Expand Down
3 changes: 1 addition & 2 deletions src/sql/workbench/api/common/sqlExtHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { ExtHostModelView } from 'sql/workbench/api/common/extHostModelView';
import { ExtHostConnectionManagement } from 'sql/workbench/api/common/extHostConnectionManagement';
import { ExtHostDashboard } from 'sql/workbench/api/common/extHostDashboard';
import { ExtHostObjectExplorer } from 'sql/workbench/api/common/extHostObjectExplorer';
import { ExtHostLogService } from 'vs/workbench/api/common/extHostLogService';
import { ExtHostModelViewDialog } from 'sql/workbench/api/common/extHostModelViewDialog';
import { ExtHostModelViewTreeViews } from 'sql/workbench/api/common/extHostModelViewTree';
import { ExtHostQueryEditor } from 'sql/workbench/api/common/extHostQueryEditor';
Expand Down Expand Up @@ -56,7 +55,7 @@ export function createApiFactory(accessor: ServicesAccessor): ISqlExtensionApiFa
const instaServer = accessor.get(IInstantiationService);
const uriTransformer = accessor.get(IURITransformerService);
const rpcProtocol = accessor.get(IExtHostRpcService);
const extHostLogService = <ExtHostLogService>accessor.get(ILogService);
const extHostLogService = accessor.get(ILogService);
let vsCodeFactory = instaServer.invokeFunction(extHostApi.createApiFactoryAndRegisterActors);

// Addressable instances
Expand Down
2 changes: 1 addition & 1 deletion src/tsconfig.monaco.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"include": [
"typings/require.d.ts",
"./typings/require-monaco.d.ts",
"typings/require-monaco.d.ts",
"typings/thenable.d.ts",
"typings/es6-promise.d.ts",
"typings/lib.es2018.promise.d.ts",
Expand Down
7 changes: 2 additions & 5 deletions src/vs/base/browser/ui/grid/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, ILayoutController, LayoutController } from './gridview';
import { orthogonal, IView as IGridViewView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize, LayoutController, IGridViewOptions } from './gridview';
import { Event } from 'vs/base/common/event';
import { InvisibleSizing } from 'vs/base/browser/ui/splitview/splitview';

Expand Down Expand Up @@ -193,11 +193,8 @@ export namespace Sizing {

export interface IGridStyles extends IGridViewStyles { }

export interface IGridOptions {
readonly styles?: IGridStyles;
readonly proportionalLayout?: boolean;
export interface IGridOptions extends IGridViewOptions {
readonly firstViewVisibleCachedSize?: number;
readonly layoutController?: ILayoutController;
}

export class Grid<T extends IView = IView> extends Disposable {
Expand Down
88 changes: 53 additions & 35 deletions src/vs/base/browser/ui/grid/gridview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ export class LayoutController implements ILayoutController {
constructor(public isLayoutEnabled: boolean) { }
}

export class MultiplexLayoutController implements ILayoutController {
get isLayoutEnabled(): boolean { return this.layoutControllers.every(l => l.isLayoutEnabled); }
constructor(private layoutControllers: ILayoutController[]) { }
}

export interface IGridViewOptions {
readonly styles?: IGridViewStyles;
readonly proportionalLayout?: boolean; // default true
Expand Down Expand Up @@ -170,6 +175,7 @@ class BranchNode implements ISplitView, IDisposable {

constructor(
readonly orientation: Orientation,
readonly layoutController: ILayoutController,
styles: IGridViewStyles,
readonly proportionalLayout: boolean,
size: number = 0,
Expand All @@ -181,7 +187,7 @@ class BranchNode implements ISplitView, IDisposable {

this.element = $('.monaco-grid-branch-node');
this.splitview = new SplitView(this.element, { orientation, styles, proportionalLayout });
this.splitview.layout(size);
this.splitview.layout(size, orthogonalSize);

const onDidSashReset = Event.map(this.splitview.onDidSashReset, i => [i]);
this.splitviewSashResetDisposable = onDidSashReset(this._onDidSashReset.fire, this._onDidSashReset);
Expand All @@ -198,12 +204,20 @@ class BranchNode implements ISplitView, IDisposable {
}
}

layout(size: number): void {
this._orthogonalSize = size;
layout(size: number, orthogonalSize: number | undefined): void {
if (!this.layoutController.isLayoutEnabled) {
return;
}

for (const child of this.children) {
child.orthogonalLayout(size);
if (typeof orthogonalSize !== 'number') {
throw new Error('Invalid state');
}

// branch nodes should flip the normal/orthogonal directions
this._size = orthogonalSize;
this._orthogonalSize = size;

this.splitview.layout(orthogonalSize, size);
}

setVisible(visible: boolean): void {
Expand All @@ -212,11 +226,6 @@ class BranchNode implements ISplitView, IDisposable {
}
}

orthogonalLayout(size: number): void {
this._size = size;
this.splitview.layout(size);
}

addChild(node: Node, size: number | Sizing, index: number): void {
if (index < 0 || index > this.children.length) {
throw new Error('Invalid index');
Expand Down Expand Up @@ -347,6 +356,10 @@ class BranchNode implements ISplitView, IDisposable {
throw new Error('Invalid index');
}

if (this.splitview.isViewVisible(index) === visible) {
return;
}

this.splitview.setViewVisible(index, visible);
this._onDidChange.fire(undefined);
}
Expand Down Expand Up @@ -539,12 +552,18 @@ class LeafNode implements ISplitView, IDisposable {
// noop
}

layout(size: number): void {
this._size = size;
layout(size: number, orthogonalSize: number | undefined): void {
if (!this.layoutController.isLayoutEnabled) {
return;
}

if (this.layoutController.isLayoutEnabled) {
this.view.layout(this.width, this.height, orthogonal(this.orientation));
if (typeof orthogonalSize !== 'number') {
throw new Error('Invalid state');
}

this._size = size;
this._orthogonalSize = orthogonalSize;
this.view.layout(this.width, this.height, orthogonal(this.orientation));
}

setVisible(visible: boolean): void {
Expand All @@ -553,22 +572,14 @@ class LeafNode implements ISplitView, IDisposable {
}
}

orthogonalLayout(size: number): void {
this._orthogonalSize = size;

if (this.layoutController.isLayoutEnabled) {
this.view.layout(this.width, this.height, orthogonal(this.orientation));
}
}

dispose(): void { }
}

type Node = BranchNode | LeafNode;

function flipNode<T extends Node>(node: T, size: number, orthogonalSize: number): T {
if (node instanceof BranchNode) {
const result = new BranchNode(orthogonal(node.orientation), node.styles, node.proportionalLayout, size, orthogonalSize);
const result = new BranchNode(orthogonal(node.orientation), node.layoutController, node.styles, node.proportionalLayout, size, orthogonalSize);

let totalSize = 0;

Expand All @@ -589,7 +600,7 @@ function flipNode<T extends Node>(node: T, size: number, orthogonalSize: number)

return result as T;
} else {
return new LeafNode((node as LeafNode).view, orthogonal(node.orientation), (node as LeafNode).layoutController, orthogonalSize) as T;
return new LeafNode((node as LeafNode).view, orthogonal(node.orientation), node.layoutController, orthogonalSize) as T;
}
}

Expand Down Expand Up @@ -634,8 +645,7 @@ export class GridView implements IDisposable {

const { size, orthogonalSize } = this._root;
this.root = flipNode(this._root, orthogonalSize, size);
this.root.layout(size);
this.root.orthogonalLayout(orthogonalSize);
this.root.layout(size, orthogonalSize);
}

get width(): number { return this.root.width; }
Expand All @@ -649,14 +659,25 @@ export class GridView implements IDisposable {
private _onDidChange = new Relay<IViewSize | undefined>();
readonly onDidChange = this._onDidChange.event;

/**
* The first layout controller makes sure layout only propagates
* to the views after the very first call to gridview.layout()
*/
private firstLayoutController: LayoutController;
private layoutController: LayoutController;

constructor(options: IGridViewOptions = {}) {
this.element = $('.monaco-grid-view');
this.styles = options.styles || defaultStyles;
this.proportionalLayout = typeof options.proportionalLayout !== 'undefined' ? !!options.proportionalLayout : true;
this.root = new BranchNode(Orientation.VERTICAL, this.styles, this.proportionalLayout);
this.layoutController = options.layoutController || new LayoutController(true);

this.firstLayoutController = new LayoutController(false);
this.layoutController = new MultiplexLayoutController([
this.firstLayoutController,
...(options.layoutController ? [options.layoutController] : [])
]);

this.root = new BranchNode(Orientation.VERTICAL, this.layoutController, this.styles, this.proportionalLayout);
}

style(styles: IGridViewStyles): void {
Expand All @@ -665,9 +686,10 @@ export class GridView implements IDisposable {
}

layout(width: number, height: number): void {
this.firstLayoutController.isLayoutEnabled = true;

const [size, orthogonalSize] = this.root.orientation === Orientation.HORIZONTAL ? [height, width] : [width, height];
this.root.layout(size);
this.root.orthogonalLayout(orthogonalSize);
this.root.layout(size, orthogonalSize);
}

addView(view: IView, size: number | Sizing, location: number[]): void {
Expand All @@ -694,9 +716,8 @@ export class GridView implements IDisposable {

grandParent.removeChild(parentIndex);

const newParent = new BranchNode(parent.orientation, this.styles, this.proportionalLayout, parent.size, parent.orthogonalSize);
const newParent = new BranchNode(parent.orientation, parent.layoutController, this.styles, this.proportionalLayout, parent.size, parent.orthogonalSize);
grandParent.addChild(newParent, parent.size, parentIndex);
newParent.orthogonalLayout(parent.orthogonalSize);

const newSibling = new LeafNode(parent.view, grandParent.orientation, this.layoutController, parent.size);
newParent.addChild(newSibling, newSiblingSize, 0);
Expand Down Expand Up @@ -827,9 +848,6 @@ export class GridView implements IDisposable {

fromParent.addChild(toNode, fromSize, fromIndex);
toParent.addChild(fromNode, toSize, toIndex);

fromParent.layout(fromParent.orthogonalSize);
toParent.layout(toParent.orthogonalSize);
}
}

Expand Down
Loading

0 comments on commit 82c1c57

Please sign in to comment.