💡⚡️ Smartly select range for refactoring under the cursor. Imports great Alt+Enter
experience of IntelliJ / Android Studio into VSCode! 🚀
Automatically expands selection to the region where at least one code action is available, in contrast to Command+.
(or Ctrl+.
in Windows) which does not show refactoring actions until selecting a whole expression by hand.
IntelliJ offers shortcut keys for individual refactor actions e.g. extract variable or function. Picker will be shown to select target expression under the cursor.
Win | Mac | Action | Type |
---|---|---|---|
Alt+Enter | Alt+Enter | Quick Fix | Nearest |
Ctrl+Shift+Alt+T | Ctrl+Shift+Alt+T (Ctrl+T in IntelliJ) |
Refactor This | Nearest |
F6 | F6 | Move | Nearest |
Ctrl+Alt+V | Command+Alt+V | Extract Local Variable | Expression |
Ctrl+Alt+C | Command+Alt+C | Extract Constant (including Local Variable) |
Expression |
Ctrl+Alt+M | Command+Alt+M | Extract Function (Extract Method in IntelliJ) |
Expression |
Ctrl+Shift+Alt+A | Command+Shift+Alt+A | Extract Type Alias | Expression |
Minimum supported VSCode version is 1.38
(including insider).
Older versions have bug around retrieving code actions, which is fixed in microsoft/vscode#77999.
intelli-refactor.useCompatSelection
: Enable this if you are using old refactor extension and getting unexpectedNo code actions available
message after selection expanded. See microsoft/vscode#49024 for detail. Selection will blink while loading actions.
Currently only supports TypeScript/JavaScript.
The icon is based on vscode's lightbulb icon.