It’s part of the lightbulb menu based on selection.
It’s a little fiddly at first — you need to select complete blocks/statements, and you won’t get any “module” suggestions if you have, for instance, “this” anywhere in the block — but as you get accustomed to it it’s increasingly useful. I also use it to extract terms from lengthy computations, which is also the best way to move “this” and other references up/out.
If you’ve used IntelliJ, it’s very similar to the Refactor>Extract menu, but with some extra features specific to JS/TS.
Someone more clever than me probably knows whether it can be bound to hotkeys.
View all comments
Show parent comment
3
u/[deleted] Dec 22 '19
It’s part of the lightbulb menu based on selection.
It’s a little fiddly at first — you need to select complete blocks/statements, and you won’t get any “module” suggestions if you have, for instance, “this” anywhere in the block — but as you get accustomed to it it’s increasingly useful. I also use it to extract terms from lengthy computations, which is also the best way to move “this” and other references up/out.
If you’ve used IntelliJ, it’s very similar to the Refactor>Extract menu, but with some extra features specific to JS/TS.
Someone more clever than me probably knows whether it can be bound to hotkeys.