Also make getEditorActions return an iterable instead of an array (#163320)

This lets us avoid an extra `.slice(0)` when returning the actions
This commit is contained in:
Matt Bierner
2022-10-11 10:22:38 -07:00
committed by GitHub
parent dace01386e
commit 01de02ba72
5 changed files with 13 additions and 10 deletions

View File

@@ -487,7 +487,7 @@ export namespace EditorExtensionsRegistry {
return EditorContributionRegistry.INSTANCE.getEditorCommand(commandId);
}
export function getEditorActions(): EditorAction[] {
export function getEditorActions(): Iterable<EditorAction> {
return EditorContributionRegistry.INSTANCE.getEditorActions();
}
@@ -546,8 +546,8 @@ class EditorContributionRegistry {
this.editorActions.push(action);
}
public getEditorActions(): EditorAction[] {
return this.editorActions.slice(0);
public getEditorActions(): Iterable<EditorAction> {
return this.editorActions;
}
public registerEditorCommand(editorCommand: EditorCommand) {