Skip to content

Latest commit

 

History

History
315 lines (242 loc) · 20.4 KB

VisualStudioShortcuts.md

File metadata and controls

315 lines (242 loc) · 20.4 KB

Visual Studio Shortcuts

Short cuts with an unhighlighted comma indicates a two part shortcut (or chord). Perform the first part, then the second part.

General

Shortcut Description R# Shortcut
Ctrl+Q Quick Launch (Search)
Alt+Shift+Enter Full screen
Ctrl+Shift+A Find Resharper command ✔️
Ctrl+Alt+Ins Create file (Class, Interface, etc) from template (similar to Ctrl+Ins) ✔️
Ctrl+\, T Task List ✔️
Ctrl+Alt+D Todo Explorer ✔️

Context Menus

Shortcut Description R# Shortcut Alternative
Ctrl+Space Show Intellisense
Ctrl+Shift+Space Show Parameter Info
Alt+Enter Show Properties or changes Ctrl+.
Ctrl+K, Ctrl+I Show QuickInfo
Ctrl+Shift+F1 Quick documentation of symbol at caret ✔️

Tab Management

Shortcut Description R# Shortcut
Ctrl+F4 Close current tab
Ctrl+Tab View active file list, (hold Ctrl, use arrow keys)
Ctrl+Alt+Down Show hidden tabs list (up/down to select)
Ctrl+F6 Go to previous tab
Ctrl+Shift+F6 Go to next tab

Regions

Shortcut Description R# Shortcut
Ctrl+M, Ctrl+O Collapse all regions
Ctrl+M, Ctrl+P Expand all regions
Ctrl+M, Ctrl+M Expand or Collapse region at cursor

Searching

Shortcut Description R# Shortcut
Ctrl+; Search Solution Explorer
Alt+E, G, G Go To (shortcut through menu)
Ctrl+Shift+F Search solution
Ctrl+Shift+H Find and replace text in all files
Ctrl+T Search: 1x: everywhere, 2x: type, 3x: text ✔️
Ctrl+Shift+T Search for File or Folder ✔️
Alt+Shift+T Search for symbol (member or type) ✔️
Ctrl+, Recent files ✔️
Ctrl+Shift+, Recent edits ✔️

Text Editing

Shortcut Description R# Shortcut Alternative Remote Desktop
Ins Toggle insert or override when typing
Ctrl+C Copy line if no text is selected
Ctrl+X Cut line if no text is selected
Ctrl+Shift+S Save all files
Ctrl+Shift+V Clipboard ring Ctrl+Shift+Ins
Shift+Enter Smart break line
Tab Indent selected text
Shift+Tab Unindent selected text
Ctrl+Alt+Shift+Up Shift line or code block up ✔️ Ctrl+Alt+Shift+H
Ctrl+Alt+Shift+Down Shift line or code block down ✔️ Ctrl+Alt+Shift+J
Ctrl+Alt+Shift+Left Move argument left ✔️ Ctrl+Alt+Shift+K
Ctrl+Alt+Shift+Right Move argument right ✔️ Ctrl+Alt+Shift+L

Highlighting

Shortcut Description R# Shortcut
Alt+Shift+F11 Highlight symbol usages (Esc to remove) ✔️
Ctrl+Alt+PgDn Go to next highlight ✔️
Ctrl+Alt+PgUp Go to previous highlight ✔️

Selection

Shortcut Description R# Shortcut Alternative
Ctrl+Alt+Right Extend selection Ctrl+W
Ctrl+Alt+Left Shrink selection Ctrl+Shift+W
Alt+Shift+Arrows Column selection Alt+Mouse Drag
Ctrl+Shift+[ Select containing declaration ✔️

Carets

Shortcut Description R# Shortcut
Ctrl+Alt+Left-Click Add caret
Alt+Shift+. Add caret at next location matching selection
Alt+Shift+; Add carets at all locations matching selection

Navigation

Shortcut Description R# Shortcut Alternative
Alt+` Navigate To destinations at caret ✔️
F12 Go to definition at caret Ctrl+Left Click
Ctrl+F12 Go to implementation at caret
Ctrl+- Go to previous location
Ctrl+Shift+- Go to next location
Ctrl+Shift+Backspace Go to last edit location
Ctrl+Alt+F7 Show related files
Alt+End Go to derived symbols of object at caret ✔️
Alt+Home Go to base symbols of object at caret ✔️
Ctrl+Shift+F11 Go to declaration of symbol type ✔️
Alt+Shift+F12 Show symbol usages ✔️
Shift+F12 Find usages of symbol ✔️
Ctrl+Alt+Shift+F12 Advanced find usages of symbol ✔️
Ctrl+K, Ctrl+T Display Call Hierarchy for member at caret ✔️
Alt+Shift+L Go to current file in Solution Explorer ✔️

Navigate Within File

Shortcut Description R# Shortcut
Ctrl+F Search File
Ctrl+H Find and replace text in file
Ctrl+G Go to line
Alt+Shift+[ Go to containing block
Ctrl+[ Go to containing declaration ✔️
Ctrl+] Go to corresponding brace
Ctrl+Shift+] Select to corresponding brace
Alt+\ Search members in class ✔️
Alt+Up Go to previous member in file ✔️
Alt+Down Go to next member in file ✔️
Alt+PgDn Go to next issue
Alt+PgUp Go to previous issue
Alt+Shift+PgDn Go to next compilation error ✔️
Alt+Shift+PgUp Go to previous compilation error ✔️
Ctrl+Alt+F File Structure ✔️

Peek View

Shortcut Description R# Shortcut
Alt+F12 Peek definition at caret. Esc to exit.
Ctrl+Alt+- Go to previous peek
Ctrl+Alt+= Go to next peek
Ctrl+Alt+Home Promote peek to new tab
Shift+Esc Toggle between peek and code
F8 Navigate down results in peek
Shift+F8 Navigate up results in peek

Code Completion

Shortcut Description R# Shortcut Solution Explorer
Ctrl+Alt+Space Smart completion ✔️
Ctrl+Shift+Enter Complete statement ✔️
Alt+Ins Generate code. ✔️ Generate File

Commenting

Shortcut Description R# Shortcut
Ctrl+K, Ctrl+C Comment selected lines
Ctrl+K, Ctrl+U Uncomment selected lines
Ctrl+Alt+/ Line Comment/Uncomment ✔️
Ctrl+Shift+/ Block Comment/Uncomment ✔️

Refactoring (SE: Multilevel in Solution Explorer)

Shortcut Description R# Shortcut Solution Explorer
Ctrl+R, Ctrl+R Rename object
Ctrl+R, G Remove and sort usings
Ctrl+R, R Rename object at caret ✔️
Ctrl+Shift+R Refactor object at caret or selection ✔️
Ctrl+K, Ctrl+D Format syntax
Ctrl+E, C Code cleanup ✔️ Apply at any level
Ctrl+Alt+Enter Apply code formatting rules ✔️ Apply at any level
Alt+Del Safe delete ✔️

Breakpoints

Shortcut Description R# Shortcut
F9 Toggle breakpoint at caret
Ctrl+F9 Enable or disable break point at caret
Ctrl+Shift+F9 Delete all break points
Alt+F9, C Breakpoint conditions
Ctrl+Alt+B Breakpoint window

Building, Running & Debugging

Shortcut Description R# Shortcut Alternative
Ctrl+Shift+B Build F6
Alt+B, R Rebuild (shortcut through menu)
F5 Start Project, or continue running
Ctrl+F5 Start without Debugging
Ctrl+Shift+F5 Restart project
Shift+F5 Stop Debugging
F10 Step over
F11 Step into
Shift+F11 Step out
Ctrl+F10 Run to cursor
Alt+Num * Go to current execution point
Ctrl+E, E Run selected code in C# Interactive
Ctrl+E, T Explore stack trace from clipboard ✔️

Testing

Shortcut Description R# Shortcut
Ctrl+R, T Run Tests
Ctrl+R, Ctrl+T Debug Tests
Ctrl+U, R Run ReSharper tests ✔️
Ctrl+U, D Debug ReSharper tests ✔️
Ctrl+Alt+T Unit test sessions ✔️
Ctrl+Alt+U Unit test explorer ✔️

Code Snippets

Code snippets are small blocks of reusable code that can be inserted into a code file. Visual Studio has built-in code snippets that can be generated by typing in the associated shortcut. This while either generate the code and pushing enter or tab.

Shortcut Description
ctor Create a constructor
prop Create a property
propg Create a private setter property
forr Create a decrementing for loop
\\\ Generate comment template for member

See: https://docs.microsoft.com/en-us/visualstudio/ide/code-snippets?view=vs-2022

Comment Tokens

These are tokens used in a comment that allows them to be easily found. These tokens should be used with a message so you know what was intended to be conveyed.

In Visual Studio current tokens in the solution can be found by Task List (defaults).
In Resharper these can be found by going to the Resharper Todo Explorer (defaults).

Shortcut Description R# Default
TODO or Todo To add or fix ✔️
UNDONE Code that is not finished (left undone)
HACK Dirty code
UnresolvedMergeConflict
Not implemented ✔️
Bug ✔️

C# Interactive

REPL for trying code snippets quickly in Visual Studio.
Can be found by going to View > Other Windows > C# Interactive.

Command Description Example
#help List commands and shortcuts
#reset core Switch to .net core
#reset 32 Switch to .net framework 32-bit
#reset 64 Switch to .net framework 64-bit
#r "path\to\my.dll" Load dll, such as a NuGet package

File Explorer

%userprofile%\.nuget\packages\ - Path to the NuGet default global package store for Windows.

File Explorer Search

"bin" OR "obj" - Find all bin and obj folders in a solution. Search from the root of the solution in File Explorer.