Revert "Make returned editor contributions an iterable instead of an array (#163309)" (#163689)

This reverts commit 90054ae22f.
This commit is contained in:
Matt Bierner
2022-10-14 13:56:47 -07:00
committed by GitHub
parent 0a6a5912a5
commit 4c53499e8a
10 changed files with 36 additions and 32 deletions

View File

@@ -24,7 +24,6 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IDisposable } from 'vs/base/common/lifecycle';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { ILogService } from 'vs/platform/log/common/log';
import { Iterable } from 'vs/base/common/iterator';
export type ServicesAccessor = InstantiationServicesAccessor;
@@ -491,15 +490,15 @@ export namespace EditorExtensionsRegistry {
return EditorContributionRegistry.INSTANCE.getEditorActions();
}
export function getEditorContributions(): Iterable<IEditorContributionDescription> {
export function getEditorContributions(): IEditorContributionDescription[] {
return EditorContributionRegistry.INSTANCE.getEditorContributions();
}
export function getSomeEditorContributions(ids: string[]): Iterable<IEditorContributionDescription> {
return Iterable.filter(EditorContributionRegistry.INSTANCE.getEditorContributions(), c => ids.indexOf(c.id) >= 0);
export function getSomeEditorContributions(ids: string[]): IEditorContributionDescription[] {
return EditorContributionRegistry.INSTANCE.getEditorContributions().filter(c => ids.indexOf(c.id) >= 0);
}
export function getDiffEditorContributions(): Iterable<IDiffEditorContributionDescription> {
export function getDiffEditorContributions(): IDiffEditorContributionDescription[] {
return EditorContributionRegistry.INSTANCE.getDiffEditorContributions();
}
}
@@ -529,16 +528,16 @@ class EditorContributionRegistry {
this.editorContributions.push({ id, ctor: ctor as IEditorContributionCtor });
}
public getEditorContributions(): Iterable<IEditorContributionDescription> {
return this.editorContributions;
public getEditorContributions(): IEditorContributionDescription[] {
return this.editorContributions.slice(0);
}
public registerDiffEditorContribution<Services extends BrandedService[]>(id: string, ctor: { new(editor: IDiffEditor, ...services: Services): IEditorContribution }): void {
this.diffEditorContributions.push({ id, ctor: ctor as IDiffEditorContributionCtor });
}
public getDiffEditorContributions(): Iterable<IDiffEditorContributionDescription> {
return this.diffEditorContributions;
public getDiffEditorContributions(): IDiffEditorContributionDescription[] {
return this.diffEditorContributions.slice(0);
}
public registerEditorAction(action: EditorAction) {