Resharper Cheat Sheet

Posted on  by 



-->

Learn how Visual Studio makes developers more productive than ever. Take advantage of our performance and productivity improvements like navigation to decompiled assemblies, variable name suggestions as you type, a hierarchy-view in Test Explorer, Go To All (Ctrl+T) to navigate to file/type/member/symbol declarations, an intelligent Exception Helper, code style configuration and enforcement, and many refactorings and code fixes.

I'm used to keyboard shortcuts from a different editor

If you're coming from another IDE or coding environment, you can change your keyboard scheme to Visual Studio Code or ReSharper (Visual Studio):

Some extensions also offer keyboard schemes:

  1. It’s seriously that easy. Let’s go over each of those steps. Now that we have this list, let’s go over each one in more details. 1 — Install Prettier locally For npm: npm install -save.
  2. Mar 08, 2021 ReSharper provides two default keyboard shortcuts schemes. Visual Studio — This scheme aims to minimize conflicts with Visual Studio's own keyboard shortcuts. IntelliJ IDEA — This scheme shares the majority of shortcuts with those used in IntelliJ IDEA and its derivative web development IDEs.

The following are popular Visual Studio shortcuts:

Resharper Keyboard Shortcuts Pdf

Shortcut (All Profiles)CommandDescription
Ctrl+TGo To AllNavigate to any file, type, member, or symbol declaration
F12 (also Ctrl+Click)Go To DefinitionNavigate to where a symbol is defined
Ctrl+F12Go To ImplementationNavigate from a base type or member to its various implementations
Shift+F12Find All ReferencesSee all symbol or literal references
Alt+HomeGo To BaseNavigate up the inheritance chain
Ctrl+. (also Alt+Enter in C# Profile)Quick Actions and RefactoringsSee what code fixes, code generation actions, refactorings, or other quick actions are available at your cursor position or code selection
Ctrl+DDuplicate lineDuplicates the line of code that the cursor is in (available in Visual Studio 2017 version 15.6 and later)
Shift+Alt++/-Expand/Contract selectionExpands or contracts the current selection in the editor (available in Visual Studio 2017 version 15.5 and later)
Shift + Alt + .Insert Next Matching CaretAdds a selection and caret at the next location that matches the current selection (available in Visual Studio 2017 version 15.8 and later)
Ctrl+QSearchSearch all Visual Studio settings
F5Start DebuggingStart debugging your application
Ctrl+F5Run without DebugRun your application locally without debugging
Ctrl+K,D (Default Profile) or Ctrl+E,D (C# Profile)Format DocumentCleans up formatting violations in your file based on your newline, spacing, and indentation settings
Ctrl+,Ctrl+E (Default Profile) or Ctrl+W,E (C# Profile)View Error ListSee all errors in your document, project, or solution
Alt + PgUp/PgDnGo to Next/Previous IssueJump to the previous/next error, warning, suggestion in your document (available in Visual Studio 2017 version 15.8 and later)
Ctrl+K,/Toggle single line comment/uncommentThis command adds or removes a single line comment depending on whether your selection is already commented
Ctrl+Shift+/Toggle block comment/uncommentThis command adds or removes block comments depending on what you have selected

Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.

Note

Some extensions unbind the default Visual Studio keybindings. To use the above commands, restore your keybindings to Visual Studio's defaults by going to Tools > Import and Export Settings > Reset all settings or Tools > Options > Keyboard > Reset.

For more information about keyboard shortcuts and commands, see Productivity shortcuts and Popular keyboard shortcuts.

Navigate quickly to files or types

Visual Studio has a feature called Go To All (Ctrl+T). Go To All enables you to quickly jump to any file, type, member, or symbol declaration.

  • Change the location of this search bar or turn off the live navigation preview by using the gear icon.
  • Filter results using syntax such as t mytype.
  • Scope your search to just the current document.
  • Camel case matching is supported.

Resharper Cheat Sheet 2019

2020

Enforce code style rules

You can use an EditorConfig file to codify coding conventions and have them travel with your source.

  • Add a default or .NET-style EditorConfig file to your project by choosing Add > New Item. In the Add New Item dialog box, search for 'editorconfig'. Select either of the editorconfig File item templates and then choose Add.

  • Automatically create an .editorconfig file based on your code style settings in Tools > Options > Text Editor > C# > Code Style.

  • The code inference feature of IntelliCode for Visual Studio infers your code styles from existing code. It then creates a non-empty EditorConfig file with your code-style preferences already defined.

  • Configure the severity level of a code style rule directly through the editor. If you currently do not have an .editorconfig file, one will be generated for you. Place your cursor on the error, warning, or suggestion and type Ctrl+. to open the Quick Actions and Refactorings menu. Select Configure or Suppress issues. Then select the rule and choose the severity level you would like to configure for that rule. This will update your existing EditorConfig with the rule’s new severity.

Check out the .NET coding convention options documentation, which also contains an example of a complete EditorConfig file.

Code Cleanup

Resharper

Visual Studio provides on-demand formatting of your code file, including code style preferences, through the Code Cleanup feature. To run Code Cleanup, click the broom icon at the bottom of the editor or press Ctrl+K, Ctrl+E.

You can also run code cleanup across your entire project or solution. Right-click on the project or solution name in Solution Explorer, select Analyze and Code Cleanup, and then select Run Code Cleanup.

In addition to formatting your file for spaces, indents, et cetera, Code Cleanup also applies selected code styles. Your preferences for each code style are read from the EditorConfig file, if you have one for the project, or from the code style settings in the Options dialog box.

Refactorings and code fixes

Visual Studio comes with numerous refactorings, code generation actions, and code fixes. Red squiggles represent errors, green squiggles represent warnings, and three gray dots represent code suggestions. You can access code fixes by clicking the light bulb or screwdriver icon, or by pressing Ctrl+. or Alt+Enter. Each fix comes with a preview window that shows a live code diff of how the fix works.

Popular quick fixes and refactorings include:

  • Rename
  • Extract Method
  • Change Method Signature
  • Generate Constructor
  • Generate Method
  • Move Type to File
  • Add Null-Check
  • Add Parameter
  • Remove Unnecessary Usings
  • Foreach Loop to LINQ Query or to LINQ method
  • Pull Members Up

Resharper 2020 Key

For more information, see code generation features.

Resharper Cheat Sheet Intellij

You can install FxCop analyzers to flag code issues. Or, write your own refactoring or code fix with Roslyn analyzers.

Visual Studio Shortcut Keys Pdf

Several community members have written free extensions that add additional code inspections:

Find Usages, Go To Implementation, and Navigate To Decompiled Assemblies

Visual Studio has many features to help you search and navigate your code.

FeatureShortcutDetails/Improvements
Find All ReferencesShift+F12Results are colorized and can be grouped by project, definition, and reference type, such as read or write. You can also 'lock' results.
Go To ImplementationCtrl+F12You can use Go To Definition on the override keyword to navigate to the overridden member
Go To DefinitionF12 or Ctrl+ClickPress Ctrl while clicking to navigate to definition
Peek DefinitionAlt+F12Inline view of a definition
Structure VisualizerGray, dotted-lines between bracesHover to see your code structure
Navigation to decompiled assembliesF12 or Ctrl+ClickNavigate to external source (decompiled with ILSpy) by enabling the feature: Tools > Options > Text Editor > C# > Advanced > Enable navigation to decompiled sources.

Improved IntelliSense

Use IntelliCode for Visual Studio to get context-aware code completions instead of just an alphabetical list. You can also train a custom IntelliSense model based on your own domain-specific libraries.

Unit testing

Starting in Visual Studio 2017, there are numerous improvements to the testing experience. You can test with the MSTest v1, MSTest v2, NUnit, or XUnit test frameworks.

  • Test Explorer test discovery is fast.

  • Organize your tests in Test Explorer with hierarchical sorting.

  • Live unit testing continuously runs tests impacted by your code changes and updates inline editor icons to let you know the status of your tests. Include or exclude specific tests or test projects from your live test set. (Visual Studio Enterprise edition only.)

Debugging

Some of Visual Studio's debugging capabilities include:

  • The ability to search for a string within the Watch, Autos, and Locals windows.
  • Run to click, which lets you hover next to a line of code, hit the green 'play' icon that appears, and run your program until it reaches that line.
  • The Exception Helper, which puts the most important information at the top level in the dialog, for example, which variable is null in a NullReferenceException.
  • Step back debugging, which lets you go back to previous breakpoints or steps and view the state of the application as it was in the past.
  • Snapshot debugging, which lets you investigate the state of a live web application at the moment an exception was thrown (must be on Azure).
  • Run to click, which lets you hover next to a line of code, hit the green 'play' icon that appears, and run your program until it reaches that line.
  • The Exception Helper, which puts the most important information at the top level in the dialog, for example, which variable is null in a NullReferenceException.
  • Step back debugging, which lets you go back to previous breakpoints or steps and view the state of the application as it was in the past.
  • Snapshot debugging, which lets you investigate the state of a live web application at the moment an exception was thrown (must be on Azure).

Version control

You can use git or TFVC to store and update your code in Visual Studio.

Resharper Cheat Sheets

  • Install the Pull requests for Visual Studio to create, review, check out, and run pull requests without leaving Visual Studio.
  • Organize your local changes in Team Explorer and use the status bar to track pending commits and changes.

  • Set up continuous integration and delivery for your ASP.NET projects inside of Visual Studio with the Continuous delivery tools for Visual Studio extension.

What other features should I know about?

Resharper Cheat Sheet Pdf

Here is a list of editor and productivity features to make writing code more efficient. Some features may need to be enabled because they are off by default (they may index things on your machine, are controversial, or are currently experimental).

FeatureDetailsHow to enable
Locate File in Solution ExplorerHighlights the active file in Solution ExplorerTools > Options > Projects and Solutions > Track Active Item in Solution Explorer
Add usings for types in reference assemblies and NuGet packagesShows an error light bulb with a code fix to install a NuGet package for an unreferenced typeTools > Options > Text Editor > C# > Advanced > Suggest usings for types in reference assemblies and Suggest usings for types in NuGet packages
Enable full solution analysisSee all errors in your solution in the Error ListTools > Options > Text Editor > C# > Advanced > Enable full solution analysis
Enable navigation to decompiled sourcesAllow Go To Definition on types/members from external sources and use the ILSpy decompiler to show method bodiesTools > Options > Text Editor > C# > Advanced > Enable navigation to decompiled sources
Completion/Suggestion ModeChanges the completion behavior in IntelliSense. Developers with IntelliJ backgrounds tend to use a non-default setting here.Menu > Edit > IntelliSense > Toggle Completion Mode
CodeLensDisplays code reference information and change history in the editor. (Source control CodeLens indicators aren't available in Visual Studio Community edition.)Tools > Options > Text Editor > All Languages > CodeLens
Code snippetsHelp stub out common boilerplate codeType a snippet name and press Tab twice.




Coments are closed