diff --git a/src/actions/base.ts b/src/actions/base.ts index 16f548a30d5d..2853e1996895 100644 --- a/src/actions/base.ts +++ b/src/actions/base.ts @@ -178,9 +178,7 @@ export class Actions { /** * Every Vim action will be added here with the @RegisterAction decorator. */ - public static allActions: { type: typeof BaseAction; action: BaseAction }[] = []; - - public static actionMap = new Map(); + public static actionMap = new Map(); /** * Gets the action that should be triggered given a key * sequence. @@ -199,13 +197,10 @@ export class Actions { let isPotentialMatch = false; var possibleActionsForMode = Actions.actionMap.get(vimState.currentMode) || []; - for (const possibleAction of possibleActionsForMode) { - const { type, action } = possibleAction!; - + for (const action of possibleActionsForMode) { if (action.doesActionApply(vimState, keysPressed)) { - const result = new type(); - result.keysPressed = vimState.recordedState.actionKeys.slice(0); - return result; + action.keysPressed = vimState.recordedState.actionKeys.slice(0); + return action; } if (action.couldActionApply(vimState, keysPressed)) { @@ -231,6 +226,6 @@ export function RegisterAction(action: typeof BaseAction): void { continue; } - actions.push({ type: action, action: actionInstance }); + actions.push(actionInstance); } }