User Tools

Site Tools


notes:tools:resharper

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
notes:tools:resharper [2019/01/08]
leszek [Troubleshooting]
notes:tools:resharper [2019/02/21] (current)
leszek
Line 1: Line 1:
 ====== ReSharper ====== ====== ReSharper ======
 +
 +Alt+Enter shows code assistance options:
 +
 +{{resharper-menu-on-selected.png}}
 +
 +While the menu is shown you can start typing an action name and ReSharper will show all related commands.
 +
 +====Search & Navigation====
 +
 +^  Command ​ ^  Keyboard Shortcut ​ ^  Remarks ​ ^  ​
 +| Select a symbol and then:\\ Navigate > Go to Declaration | F12 | - Navigates to the declaration of the selected symbol\\ - Navigates to partial classes and decompiled sources\\ - Navigates to base symbols or derived symbols of overridden members. |
 +| Navigate > Go to Everything / Type | Ctrl+T | - Also navigates to filenames.\\ - Allows you to include types from libraries.\\ - Supports camel humps search.\\ - Supports jumping to a specified line in source code.\\ - Double Ctrl+T allows you to search just the types (no filenames, no members, etc.). |
 +| Navigate > Go to Symbol | Shift+Alt+T | Navigates to a class as well as any class member. |
 +| Navigate > Go to File Member | Alt+\ | Navigates to members is the current file. |
 +| Navigate > Go to Text | Ctrl+T Ctrl+T Ctrl+T | Includes text in comments. |
 +| Navigate > Go to Action | Ctrl+Shift+A | - Searches ReSharper own functionality.\\ - Shows where the actions are in the menu.\\ - Shows keyboard shortcuts. |
 +
 +Navigate down and up the class hierarchy:
 +
 +^  Command ​ ^  Keyboard Shortcut ​ ^  Remarks ​ ^  ​
 +| Navigate > Derived Symbols\\ (after selecting an interface or a base class name) | Alt+End | Shows derived classes from the selected interface or the base class.\\ Also shows the classes that derive indirectly (transitive relationships). |
 +| Navigate > Base Symbols | Alt+Home | You can also navigate to the base symbol by clicking an icon on the left gutter. |
 +| Inspect > Hierarchies | Ctrl+E,H | - Visualizes inheritance hierarchy.\\ - Brings architecture explorer (diagram). |
 +
 +You can also go up and down on the hierarchy of members such as overridden properties and methods.
 +
 +Alt+` shows Navigate To menu. It shows any possible navigation option available for the selected symbol.
 +
 +{{resharper-navigate-to.png}}
 +
 +Numbered bookmarks, for example '​1':​
 +
 +  * Toggle a bookmark: Ctrl+Shift+1
 +  * Go to a bookmark: Ctrl+1
 +  * Delete a bookmark: Del in the Bookmark menu
 +
 +^  Command ​ ^  Keyboard Shortcut ​ ^  Remarks ​ ^  ​
 +| Navigate > Bookmarks > Bookmarks | Ctrl+` | Shows the list of bookmarks (numbered and anonymous). |
 +
 +Find all locations a selected symbol is used:
 +
 +  * Navigate > Usages of Symbol (Shift+Alt+F12) - shows usages
 +  * Find > Find Usages (Shift+F12) - shows a separate window with preview code
 +
 +Find locations where a class is returned from a method or a property:
 +
 +  * Navigate > Navigate To (Alt+`) > Exposing APIs
 +
 +Find extensions methods which are defined on a selected class:
 +
 +  * Navigate > Navigate To (Alt+`) > Extension Methods
 +
 +
 +====Coding Assistance====
 +
 +Code Analysis
 +
 +  * show available coding assistence options: put cursor over a symbol, Alt+Enter ​
 +  * Marker Bar 
 +
 +Usings and References
 +
 +  * Import a missing using statement: Alt+Enter. It also creates a reference if needed.
 +  * You can also use the ReSharper NuGet browser.
 +
 +Typing Experience
 +
 +  * Duplicate a line of code or a selection: Ctrl+D
 +  * Extend selection: Ctrl+Alt+RightArrow
 +  * Rearrange code (mode a line of code up and down): Ctrl+Shift+Alt+UpArrow,​ Ctrl+Shift+Alt+DownArrow
 +
 +Code Completion
 +
 +  * Complete Statement (adding a semicolor, missing parentheses,​ scope brackets, etc.): Ctrl+Shift+Enter
 +  * Camel humps in IntelliSense code completion.
 +  * Double basic code completion: 2 x Ctrl+Space
 +  * Smart Code Completion (shows only relevant members in IntelliSense,​ for example, the ones that return an int): Ctrl+Alt+Space
 +  * Multi-level smart code completion shows indirect members: Ctrl+Alt+Space multiple times.
 +  * Generative completion examples: ctorf (a ctor that initializes all fields), ctorp (a ctor that initializes all properties),​ overrides (type a method name e.g., ToString and then press Tab).
 +
 +Code Generation:
 +
 +  * Open Generate Code menu: Alt+Insert
 +
 +Postfix completion:
 +
 +[[https://​www.jetbrains.com/​help/​resharper/​Postfix_Templates.html|Postfix Templates]]
 +
 +{{resharper-postfix-completion.png}}
 +
 +{{resharper-postfix-completion-2.png}}
 +
 +
 +Encapsulating property generation:
 +
 +{{resharper-encapsulating-property.png}}
 +
 +
 +====Templates====
 +
 +**Live Templates** (Tools > Templates Explorer) include:
 +
 +  * Templates imported from Visual Studio
 +  * Templates shipped with ReSharper e.g., ''​%%cw%%''​ generates ''​%%Console.WriteLine%%''​
 +  * Custom templates
 +
 +Create a new Live Template:
 +
 +  * Click the button New Template from the toolbar
 +  * Provide body for the template
 +    * Template parameters:
 +      * ''​%%$NAME$%%'',​ example: ''​%%public class $NAME$%%''​
 +      * ''​%%$END$%%''​ - specifies where the cursor is located after the template is fully expanded
 +      * Parameters may be editable which means when the template is expanded, the user can type something
 +      * Parameters may use macros - a macro will expand in place of the parameter. Examples of macros: Clipboard content.
 +  * Define a shortcut for the template.
 +  * You can check the Reformat checkbox - the template will be automatically reformatted.
 +  * You can shorted qualified references. For example, ''​%%System.IDisposable%%''​ will become ''​%%IDisposable%%''​
 +  * Save your template: File > Save Selected Items -or- Ctrl+S
 +
 +
 +**Surround Templates** (Tools > Templates Explorer) include:
 +
 +  * Templates imported from Visual Studio
 +  * The ''​%%$SELECTION$%%''​ template parameter specifies whatever we need to surround
 +
 +
 +Show built-in surround templates:
 +
 +  * Edit > Surround With Template
 +  * Shortcut: Ctrl+E+U
 +  * Select a mnemonic from 0 to 9
 +
  
 ====Options==== ====Options====
Line 34: Line 167:
  
   * Additional products: dotMemory, dotTrace, etc.   * Additional products: dotMemory, dotTrace, etc.
 +
 +Configure what happens when you Go To Declaration:​
 +
 +{{resharper-external-sources.png?​600}}
 +
 ====Troubleshooting==== ====Troubleshooting====
  
notes/tools/resharper.1547005174.txt.gz ยท Last modified: 2019/01/08 by leszek