microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.03k stars 12.37k forks source link

Preferred refactorings #29587

Open mjbvz opened 5 years ago

mjbvz commented 5 years ago

Problems

Proposal In the TS Server protocol, mark some refactoring as a preferred refactorings. Editors could use this information to automatically select the preferred refactoring in the list or even quick apply it without any user input (see https://github.com/Microsoft/vscode/issues/62110 for VS Code's proposal on this)

Preferred refactorings would let users set up actions such as extract constant that reliably extract to the nearest scope with a single action or keyboard shortcut. The UX behavior for this type of action:

The normal refactor context menu with full list of refactorings would continue to display the full list of refactorings.

We can start conservative with which refactorings are preferred:

Related to a similar proposal for quick fixes #29450

mjbvz commented 2 years ago

Marking as a priority since this is a smaller feature that would better align TS with the LSP