提交 e7f559cd 编写于 作者: M Matt Bierner

Mark keybindings arrays as readonly

These arrays should not be mutated by callers as it would cause the keybinding service to have unexpected behavior
上级 d62481b6
......@@ -65,11 +65,11 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
return '';
}
public getDefaultKeybindings(): ResolvedKeybindingItem[] {
public getDefaultKeybindings(): readonly ResolvedKeybindingItem[] {
return this._getResolver().getDefaultKeybindings();
}
public getKeybindings(): ResolvedKeybindingItem[] {
public getKeybindings(): readonly ResolvedKeybindingItem[] {
return this._getResolver().getKeybindings();
}
......
......@@ -87,9 +87,9 @@ export interface IKeybindingService {
getDefaultKeybindingsContent(): string;
getDefaultKeybindings(): ResolvedKeybindingItem[];
getDefaultKeybindings(): readonly ResolvedKeybindingItem[];
getKeybindings(): ResolvedKeybindingItem[];
getKeybindings(): readonly ResolvedKeybindingItem[];
customKeybindingsCount(): number;
......
......@@ -215,11 +215,11 @@ export class KeybindingResolver {
return this._defaultBoundCommands;
}
public getDefaultKeybindings(): ResolvedKeybindingItem[] {
public getDefaultKeybindings(): readonly ResolvedKeybindingItem[] {
return this._defaultKeybindings;
}
public getKeybindings(): ResolvedKeybindingItem[] {
public getKeybindings(): readonly ResolvedKeybindingItem[] {
return this._keybindings;
}
......
......@@ -517,7 +517,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
);
}
private static _getDefaultKeybindings(defaultKeybindings: ResolvedKeybindingItem[]): string {
private static _getDefaultKeybindings(defaultKeybindings: readonly ResolvedKeybindingItem[]): string {
let out = new OutputBuilder();
out.writeLine('[');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册