In Visual Studio 2010, is there any way to quickly extend the selected text to the next logical code block? For example, if my cursor was here:
And I hit some magical keyboard shortcut, it would select the entire string:
Hit it again, and it would select the next larger logical block of code:
And so on. Does this exist? My google-fu seems to be failing me..
Shrink/expand selection# Quickly shrink or expand the current selection. Trigger it with Shift+Alt+Left and Shift+Alt+Right.
CTRL + M + O will collapse all. CTRL + M + P will expand all and disable outlining. CTRL + M + M will collapse/expand the current section.
You can select blocks of text by holding Shift+Alt (Shift+Option on macOS) while you drag your mouse. A separate cursor will be added to the end of each selected line.
ctrl + b is bound to Add Function Breakpoint by default. You can edit the shortcuts from File->Preferences->Keyboard Shortcuts . Show activity on this post. File > Preferences > Keyboard Shortcuts will show you a list of shortcuts.
Visual Studio 2017 15.5.2 appears to have this feature built-in after it was first hinted at in a Visual Studio 2017 Preview blog post (see section "Smart Code Editor").
Invoking it can be done by going to Edit > Advanced > Expand Selection
or by binding the Edit.ExpandSelection
command to Ctrl+W
(actually the new default if you start without any previous keybindings).
Shrinking / contracting the selection is possible as well, look for Edit > Advanced > Contract Selection
or the Edit.ContractSelection
command (default Ctrl+Shift+W
).
In ReSharper, this is extend selection and the shortcut is CTRL-W. Not sure of a non-ReSharper solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With