VSCode Keyboard Shortcut: Shrink and Expand Text Selection
Shrink or Expand current text selection is a Visual Studio Code keyboard shortcut that works like a text selection flood algorithm around important quotes, scopes and brackets.
You can expand or contract text selection around closest single or double quotes, brackets, braces, HTML tags, JavaScript function and other block scopes. It can expand in both directions.
This shortcut is useful for quickly selecting parent scope without touching the mouse. (For example if you need to select to copy or delete entire contents of a parent scope.) And that's just one example!
To get started, first make any text selection (it can be just a single text character, a word or space between brackets.) Then follow instructions below:
To shrink or expand text selection press and hold Alt + Shift keys and use left and right arrow keys to either minimize or expand current selection.
How to shrink or expand text selection in VSCode:
To expand or shrink selection use following steps:
- Select quoted text, a single line of code, a function or a similar scope.
- Press and hold Alt + Shift keys.
- Use left arrow and right arrow keys to expand or shrink selection.
- The selection will stop at nearest double quotes, inner scope, parent scope, etc.
VSCode Keyboard Shortcut: How to Shrink or Expand Text Selection
This video visually explains how to shrink or expand your VSCode text selection with automatic stopping points around important scope limits.