Ever spent too much time trying to select just the right chunk of code? π€ The "Balance Outward" shortcut in VS Code can save you tons of time!
What Does It Do?
The Balance Outward shortcut intelligently expands your current selection to include the next logical "block" of code based on the structure you're working in. This works great for:
- Selecting content inside parentheses
()
, brackets[]
, or curly braces{}
. - Expanding to encompass larger blocks like entire function bodies, HTML tags, or JSX components.
How to Use It π
- Open VS Code and place your cursor inside the code you want to select.
-
Open the Command Palette:
- Press
Ctrl + Shift + P
(Windows/Linux) orCmd + Shift + P
(Mac) to open the Command Palette.
- Press
-
Search for the "Balance Outward" Command:
- Type βBalance Outwardβ in the Command Palette search bar.
- Select the Balance Outward option to activate it.
- Also you can create a keyboard shortcut by
- Click on Settings
- Click on Keyboard Shortcuts
- Search Balance Outward and assign a key binding to it say
Ctrl + Shift + β
-
Shortcut:
- After creating the shortcut, you can also use the shortcut to quickly expand your selection:
-
Windows/Linux:
Ctrl + Shift + β
-
Mac:
Cmd + Shift + β
Each time you press the shortcut, the selection expands outward to the next logical scope, allowing you to quickly select entire blocks of code. π±οΈ
Demo:
Say goodbye to manual dragging with your mouse. π Share this tip with your dev friends who love clean workflows!
Follow me for more content like this...
Let's connect LinkedIn
Top comments (0)