Is there a keyboard shortcut or an extension that would allow me to select a block of code? I\'d like to select everything between curly braces, between html tags, etc.
A quicker way is selecting a line then expanding the selection like this:
Doing this inside a block(html element, javascript curly braces) will select the inner block(html element content, inside curly braces). Do step 2 again to select block including the container(html element, whole function, class, etc...)
Here are some useful shortcuts for working with blocks of code:
alt + shift + ] to select current block of code.
alt + shift + [ move cursor to beginning of code block and again to move to parent block.
ctrl + ] move cursor from bracket to bracket.
ctrl + shift + ] select block of code between brackets.
See the Default keyboard shortcuts in Visual Studio under the Text Editor section for more. It takes some trial and error to find the right combo of shortcuts to suit your needs.
Use alt + shift + → to expand selection between braces or tags,
Use alt + shift + ← to shrink selection between braces or tags.
Here is vc shortcuts cheatsheet that might help you.
Update 2019/3: this inner functionality of vs is not working very well after some updates, alt + shift + →
now selects things including braces (which annoys me), not like its behavior before, it selected things between curly braces before, when I first posted this answer. I'm using Mark's answer now. If anyone has better soulution (without extension) now, please leave a comment.
On Mac Ctrl + Shift + → to expand the selection. Press multiple times to expand to the block.
Try the expand-region extension. It currently works for javascript and html. To select ever-increasing or decreasing scope.