VSCodeVim/Vim

Remove subclassing from actions.ts

Open

#519 aberto em 26 de jul. de 2016

Ver no GitHub
 (0 comments) (1 reaction) (0 assignees)TypeScript (1.271 forks)batch import
help wantedkind/refactorsize/M

Métricas do repositório

Stars
 (12.664 stars)
Métricas de merge de PR
 (Mesclagem média 9d 13h) (7 fundiu PRs em 30d)

Description

We have this pattern going on in actions.ts where, if we want to implement an action that's similar to another action, we make a new class that just extends the old class and reimplements what changed.

I am not a big fan of this. The main problem is that if someone changes the base class, it's not obvious at all that the subclasses could have been depending on the behavior of the base class.

I would like to refactor actions.ts so that no concrete actions extend from other concrete actions. This can be done in two steps.

  • For all actions that are synonyms (ctrl-[ and esc, for example), we need to make the keys variable accept a list of key sequences rather than just one.
  • For all actions that are not synonyms but actually have differing implementations (not sure how many of these we even have), I am ok with extending from a shared "abstract" base class.

Guia do colaborador