Merge from vscode 731f9c25632dbbf01ee3a7892ad9d2791fe0260c

This commit is contained in:
ADS Merger
2020-07-24 05:27:34 +00:00
parent eccf3cf5fe
commit d965d4aef3
145 changed files with 3072 additions and 1550 deletions

View File

@@ -39,14 +39,18 @@ export interface IActionRunner extends IDisposable {
}
export interface IActionViewItem extends IDisposable {
readonly actionRunner: IActionRunner;
actionRunner: IActionRunner;
setActionContext(context: any): void;
render(element: any /* HTMLElement */): void;
isEnabled(): boolean;
focus(): void;
focus(fromRight?: boolean): void; // TODO@isidorn what is this?
blur(): void;
}
export interface IActionViewItemProvider {
(action: IAction): IActionViewItem | undefined;
}
export interface IActionChangeEvent {
readonly label?: string;
readonly tooltip?: string;
@@ -218,3 +222,22 @@ export class RadioGroup extends Disposable {
}
}
}
export class Separator extends Action {
static readonly ID = 'vs.actions.separator';
constructor(label?: string) {
super(Separator.ID, label, label ? 'separator text' : 'separator');
this.checked = false;
this.enabled = false;
}
}
export type SubmenuActions = IAction[] | (() => IAction[]);
export class SubmenuAction extends Action {
constructor(id: string, label: string, readonly actions: SubmenuActions, cssClass?: string) {
super(id, label, cssClass, true);
}
}

View File

@@ -473,11 +473,10 @@ export function range(arg: number, to?: number): number[] {
}
export function index<T>(array: ReadonlyArray<T>, indexer: (t: T) => string): { [key: string]: T; };
export function index<T, R>(array: ReadonlyArray<T>, indexer: (t: T) => string, merger?: (t: T, r: R) => R): { [key: string]: R; };
export function index<T, R>(array: ReadonlyArray<T>, indexer: (t: T) => string, merger: (t: T, r: R) => R = t => t as any): { [key: string]: R; } {
export function index<T, R>(array: ReadonlyArray<T>, indexer: (t: T) => string, mapper: (t: T) => R): { [key: string]: R; };
export function index<T, R>(array: ReadonlyArray<T>, indexer: (t: T) => string, mapper?: (t: T) => R): { [key: string]: R; } {
return array.reduce((r, t) => {
const key = indexer(t);
r[key] = merger(t, r[key]);
r[indexer(t)] = mapper ? mapper(t) : t;
return r;
}, Object.create(null));
}