Skip to content

Commit 9f6de38

Browse files
committed
Use ReadonlyArray for a few more lists of IActions
Also changes processService to not modify its input actions, which seems like unexpected behavior
1 parent e78f05a commit 9f6de38

11 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/vs/base/browser/ui/inputbox/inputBox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface IInputOptions extends IInputBoxStyles {
2828
readonly type?: string;
2929
readonly validationOptions?: IInputValidationOptions;
3030
readonly flexibleHeight?: boolean;
31-
readonly actions?: IAction[];
31+
readonly actions?: ReadonlyArray<IAction>;
3232
}
3333

3434
export interface IInputBoxStyles {

src/vs/base/parts/tree/browser/tree.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ export interface IActionProvider {
576576
hasActions(tree: ITree | null, element: any): boolean;
577577

578578
/**
579-
* Returns a promise of an array with the actions of the element that should show up in place right to the element in the tree.
579+
* Returns an array with the actions of the element that should show up in place right to the element in the tree.
580580
*/
581-
getActions(tree: ITree | null, element: any): IAction[] | null;
581+
getActions(tree: ITree | null, element: any): ReadonlyArray<IAction> | null;
582582
}

src/vs/editor/contrib/contextmenu/contextmenu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export class ContextMenuController implements IEditorContribution {
125125
}
126126
}
127127

128-
private _getMenuActions(model: ITextModel): IAction[] {
128+
private _getMenuActions(model: ITextModel): ReadonlyArray<IAction> {
129129
const result: IAction[] = [];
130130

131131
let contextMenu = this._menuService.createMenu(MenuId.EditorContext, this._contextKeyService);
@@ -141,7 +141,7 @@ export class ContextMenuController implements IEditorContribution {
141141
return result;
142142
}
143143

144-
private _doShowContextMenu(actions: IAction[], anchor: IAnchor | null = null): void {
144+
private _doShowContextMenu(actions: ReadonlyArray<IAction>, anchor: IAnchor | null = null): void {
145145
if (!this._editor.hasModel()) {
146146
return;
147147
}

src/vs/editor/contrib/gotoError/gotoErrorWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class MarkerNavigationWidget extends PeekViewWidget {
180180

181181
constructor(
182182
editor: ICodeEditor,
183-
private readonly actions: IAction[],
183+
private readonly actions: ReadonlyArray<IAction>,
184184
private readonly _themeService: IThemeService
185185
) {
186186
super(editor, { showArrow: true, showFrame: true, isAccessible: true });

src/vs/platform/progress/common/progress.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ export interface IProgressOptions {
6161
}
6262

6363
export interface IProgressNotificationOptions extends IProgressOptions {
64-
location: ProgressLocation.Notification;
65-
primaryActions?: IAction[];
66-
secondaryActions?: IAction[];
64+
readonly location: ProgressLocation.Notification;
65+
readonly primaryActions?: ReadonlyArray<IAction>;
66+
readonly secondaryActions?: ReadonlyArray<IAction>;
6767
}
6868

6969
export interface IProgressCompositeOptions extends IProgressOptions {

src/vs/workbench/browser/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class ActionBarContributor {
2424
/**
2525
* Returns an array of primary actions in the given context.
2626
*/
27-
getActions(context: unknown): IAction[] {
27+
getActions(context: unknown): ReadonlyArray<IAction> {
2828
return [];
2929
}
3030
}
@@ -66,7 +66,7 @@ export class ContributableActionProvider implements IActionProvider {
6666
return false;
6767
}
6868

69-
getActions(tree: ITree, element: unknown): IAction[] {
69+
getActions(tree: ITree, element: unknown): ReadonlyArray<IAction> {
7070
const actions: IAction[] = [];
7171
const context = this.toContext(tree, element);
7272

src/vs/workbench/browser/parts/editor/editor.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export class QuickOpenActionContributor extends ActionBarContributor {
253253
return !!entry;
254254
}
255255

256-
getActions(context: any): IAction[] {
256+
getActions(context: any): ReadonlyArray<IAction> {
257257
const actions: Action[] = [];
258258

259259
const entry = this.getEntry(context);

src/vs/workbench/browser/parts/notifications/notificationsActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ export class ConfigureNotificationAction extends Action {
121121
constructor(
122122
id: string,
123123
label: string,
124-
private _configurationActions: IAction[]
124+
private readonly _configurationActions: ReadonlyArray<IAction>
125125
) {
126126
super(id, label, 'configure-notification-action');
127127
}
128128

129-
get configurationActions(): IAction[] {
129+
get configurationActions(): ReadonlyArray<IAction> {
130130
return this._configurationActions;
131131
}
132132
}

src/vs/workbench/contrib/tasks/browser/quickOpen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export class QuickOpenActionContributor extends ActionBarContributor {
214214
return !!task;
215215
}
216216

217-
public getActions(context: any): IAction[] {
217+
public getActions(context: any): ReadonlyArray<IAction> {
218218
let actions: Action[] = [];
219219
let task = this.getTask(context);
220220
if (task && ContributedTask.is(task) || CustomTask.is(task)) {

src/vs/workbench/contrib/terminal/browser/terminalActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ export class QuickOpenActionTermContributor extends ActionBarContributor {
10411041
super();
10421042
}
10431043

1044-
public getActions(context: any): IAction[] {
1044+
public getActions(context: any): ReadonlyArray<IAction> {
10451045
const actions: Action[] = [];
10461046
if (context.element instanceof TerminalEntry) {
10471047
actions.push(this.instantiationService.createInstance(RenameTerminalQuickOpenAction, RenameTerminalQuickOpenAction.ID, RenameTerminalQuickOpenAction.LABEL, context.element));

0 commit comments

Comments
 (0)