Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -57,22 +57,6 @@ export class ActionBarContributor {
* Some predefined scopes to contribute actions to
*/
export const Scope = {
/**
* Actions inside viewlets.
*/
VIEWLET: 'viewlet',
/**
* Actions inside panels.
*/
PANEL: 'panel',
/**
* Actions inside editors.
*/
EDITOR: 'editor',
/**
* Actions inside tree widgets.
*/
@@ -97,11 +81,11 @@ export class ContributableActionProvider implements IActionProvider {
}
public hasActions(tree: ITree, element: any): boolean {
let context = this.toContext(tree, element);
const context = this.toContext(tree, element);
let contributors = this.registry.getActionBarContributors(Scope.VIEWER);
const contributors = this.registry.getActionBarContributors(Scope.VIEWER);
for (let i = 0; i < contributors.length; i++) {
let contributor = contributors[i];
const contributor = contributors[i];
if (contributor.hasActions(context)) {
return true;
}
@@ -111,13 +95,13 @@ export class ContributableActionProvider implements IActionProvider {
}
public getActions(tree: ITree, element: any): TPromise<IAction[]> {
let actions: IAction[] = [];
let context = this.toContext(tree, element);
const actions: IAction[] = [];
const context = this.toContext(tree, element);
// Collect Actions
let contributors = this.registry.getActionBarContributors(Scope.VIEWER);
const contributors = this.registry.getActionBarContributors(Scope.VIEWER);
for (let i = 0; i < contributors.length; i++) {
let contributor = contributors[i];
const contributor = contributors[i];
if (contributor.hasActions(context)) {
actions.push(...contributor.getActions(context));
}
@@ -127,11 +111,11 @@ export class ContributableActionProvider implements IActionProvider {
}
public hasSecondaryActions(tree: ITree, element: any): boolean {
let context = this.toContext(tree, element);
const context = this.toContext(tree, element);
let contributors = this.registry.getActionBarContributors(Scope.VIEWER);
const contributors = this.registry.getActionBarContributors(Scope.VIEWER);
for (let i = 0; i < contributors.length; i++) {
let contributor = contributors[i];
const contributor = contributors[i];
if (contributor.hasSecondaryActions(context)) {
return true;
}
@@ -141,13 +125,13 @@ export class ContributableActionProvider implements IActionProvider {
}
public getSecondaryActions(tree: ITree, element: any): TPromise<IAction[]> {
let actions: IAction[] = [];
let context = this.toContext(tree, element);
const actions: IAction[] = [];
const context = this.toContext(tree, element);
// Collect Actions
let contributors = this.registry.getActionBarContributors(Scope.VIEWER);
const contributors = this.registry.getActionBarContributors(Scope.VIEWER);
for (let i = 0; i < contributors.length; i++) {
let contributor = contributors[i];
const contributor = contributors[i];
if (contributor.hasSecondaryActions(context)) {
actions.push(...contributor.getSecondaryActions(context));
}
@@ -157,13 +141,13 @@ export class ContributableActionProvider implements IActionProvider {
}
public getActionItem(tree: ITree, element: any, action: Action): BaseActionItem {
let contributors = this.registry.getActionBarContributors(Scope.VIEWER);
let context = this.toContext(tree, element);
const contributors = this.registry.getActionBarContributors(Scope.VIEWER);
const context = this.toContext(tree, element);
for (let i = contributors.length - 1; i >= 0; i--) {
let contributor = contributors[i];
const contributor = contributors[i];
let itemProvider = contributor.getActionItem(context, action);
const itemProvider = contributor.getActionItem(context, action);
if (itemProvider) {
return itemProvider;
}
@@ -180,24 +164,33 @@ export function prepareActions(actions: IAction[]): IAction[] {
}
// Patch order if not provided
let lastOrder = -1;
let orderOffset = 0;
for (let l = 0; l < actions.length; l++) {
let a = <any>actions[l];
const a = <any>actions[l];
if (types.isUndefinedOrNull(a.order)) {
a.order = l;
a.order = ++lastOrder;
orderOffset++;
} else {
a.order += orderOffset;
}
lastOrder = a.order;
}
// Sort by order
actions = actions.sort((first: Action, second: Action) => {
let firstOrder = first.order;
let secondOrder = second.order;
const firstOrder = first.order;
const secondOrder = second.order;
if (firstOrder < secondOrder) {
return -1;
} else if (firstOrder > secondOrder) {
return 1;
} else {
return 0;
}
if (firstOrder > secondOrder) {
return 1;
}
return 0;
});
// Clean up leading separators
@@ -219,7 +212,7 @@ export function prepareActions(actions: IAction[]): IAction[] {
// Clean up trailing separators
for (let h = actions.length - 1; h >= 0; h--) {
let isSeparator = actions[h].id === Separator.ID;
const isSeparator = actions[h].id === Separator.ID;
if (isSeparator) {
actions.splice(h, 1);
} else {
@@ -230,7 +223,7 @@ export function prepareActions(actions: IAction[]): IAction[] {
// Clean up separator duplicates
let foundAction = false;
for (let k = actions.length - 1; k >= 0; k--) {
let isSeparator = actions[k].id === Separator.ID;
const isSeparator = actions[k].id === Separator.ID;
if (isSeparator && !foundAction) {
actions.splice(k, 1);
} else if (!isSeparator) {
@@ -290,7 +283,7 @@ class ActionBarRegistry implements IActionBarRegistry {
this.instantiationService = service;
while (this.actionBarContributorConstructors.length > 0) {
let entry = this.actionBarContributorConstructors.shift();
const entry = this.actionBarContributorConstructors.shift();
this.createActionBarContributor(entry.scope, entry.ctor);
}
}
@@ -309,7 +302,7 @@ class ActionBarRegistry implements IActionBarRegistry {
}
public getActionBarActionsForContext(scope: string, context: any): IAction[] {
let actions: IAction[] = [];
const actions: IAction[] = [];
// Go through contributors for scope
this.getContributors(scope).forEach((contributor: ActionBarContributor) => {
@@ -324,7 +317,7 @@ class ActionBarRegistry implements IActionBarRegistry {
}
public getSecondaryActionBarActionsForContext(scope: string, context: any): IAction[] {
let actions: IAction[] = [];
const actions: IAction[] = [];
// Go through contributors
this.getContributors(scope).forEach((contributor: ActionBarContributor) => {
@@ -339,10 +332,10 @@ class ActionBarRegistry implements IActionBarRegistry {
}
public getActionItemForContext(scope: string, context: any, action: Action): BaseActionItem {
let contributors = this.getContributors(scope);
const contributors = this.getContributors(scope);
for (let i = 0; i < contributors.length; i++) {
let contributor = contributors[i];
let item = contributor.getActionItem(context, action);
const contributor = contributors[i];
const item = contributor.getActionItem(context, action);
if (item) {
return item;
}