Your SlideShare is downloading. ×
  • Like
ReSharper Presentation for NUGs
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

ReSharper Presentation for NUGs


ReSharper presentation that can be given by .Net user group leaders.

ReSharper presentation that can be given by .Net user group leaders.

Published in Business , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. IntroducingThe most intelligent plug-in forVisual Studio 1
  • 2. ReSharper in a NutshellCoding productivity tool for Visual Studio usersSupports C#, VB.NET, XML, XAML, ASP.NET, HTML/ CSS/JavaScript, build scriptsContinuous code quality analysis: error detection and quick-fixesNavigation, coding assistance, code generation, unit test integration… 2
  • 3. Visual Studio with ReSharper 3
  • 4. Syntax HighlightingR# extends VS highlighting: For fields, variables, constants, methods, operators, types, etc. In C# and VB.NET: 4
  • 5. Code AnalysisR# provides on-the-fly code quality analysis.4 categories of analysis results: Errors Warnings Suggestions Hints 5
  • 6. Code Inspections WikiSome suggestions are very technical, so ReSharper offers explanations: Clicking on the “Why is ReSharper Suggesting This” item opens up the corresponding page in the Code Inspection Wiki: 6
  • 7. Marker Bar Marker Bar is a sidebar to the right-  Status Indicator shows the hand side of the text editor. overall status of the current file: MB represents all R# highlights in file (warnings, errors, suggestions,  It changes color if file contains to-do items and search results): errors or warnings: File contains compilation errors File has warnings but no errors File doesnt contain errors or warnings 7
  • 8. Solution-Wide Analysis ReSharper can analyze your whole solution for errors To turn on, double-click the bottom left icon in Visual Studio: Circle is green if there are no errors, red otherwise Double-click the circle to see a list of issues 8
  • 9. Find Code Issues ReSharper can locate all issues (errors  ReSharper can also help find issues and warnings) in the current project or similar to the one that has just been the whole solution encountered: To get a list of issues, use the menu item ReSharper | Inspect | Code Issues in Solution/Current Project ReSharper presents a tree of all issues  Similar issues can be searched at found, with various grouping options: different (including Custom) scopes: 9
  • 10. Quick-Fixes Quick-fixes make you code free of errors and smells Available for most errors, warnings, and suggestions that R# displays Bulbs used to indicate availability Red bulb indicates an error Yellow bulb indicates a warning To display the list of available quick-fixes, press Alt+Enter: Hundreds of quick-fixes to perform multiple fixes 10
  • 11. Context Actions Context actions are "mini-refactorings" intended for optional code transformations in a certain context. Examples:  Modifying the structure of conditional statements  Joining local variable declaration and assignment  Iterating collections with foreach statements Context actions are available for C#, VB.NET and XML Pencil icon to the left a code line means CAs are available 11
  • 12. Code Completion R# complements native VS IntelliSense with 3 types of code completion:  Symbol Completion  Smart Completion  Import Symbol Completion Enhancements compared to Visual Studio include:  Immediate members are highlighted (vs inherited members)  All overloads displayed in a pop-up, you can scroll between them  Icons for parameters and local vars to distinguish them from fields  Completion list is narrowed down to match user input  CamelHumps: complete a long type name by typing “drfb" instead of "DecoderReplacementFallbackBuffer" 12
  • 13. Symbol Completion Suggesting type-based variable names: Suggesting members of a class: Suggesting visible types: 13
  • 14. Symbol Completion (cont.) Suggesting C# keywords: Symbol completion using CamelHumps: Completing names of symbols in build scripts: 14
  • 15. Smart Completion Smart Code Completion (Ctrl+Alt+Space):  Filters the list of types, methods, and variables to match the expected type of an expression  If several return types are possible, detects the most recently used symbol of an applicable type and focuses it in the lookup list  Suggests creating anonymous delegates, lambda expressions, and regular methods, as well as local variables for out parameters  In object initializers, suggests fields/properties that were not yet assigned a value 15
  • 16. Smart Completion (cont.) In object initializers: In lambda expressions: Creating a local variable in place of an out parameter: 16
  • 17. Import Completion In C# for extension methods: In C# using CamelHumps: In ASP.NET: 17
  • 18. Complete Statement Complete Statement (Ctrl+Shift+Enter):  Inserts necessary syntax elements (braces, semicolons etc.) and gets you in position to start the next statement  Is helpful in auto-closing parentheses, adding semicolons, completing if, while and for statements etc.  Available for type members, statements, and expressions Nested method invocation: before Complete Statement: Nested method invocation: after Complete Statement: 18
  • 19. Parameter Info When you call a method, Parameter Info (Ctrl+Shift+Space):  Automatically shows all available signatures and parameters with relevant documentation  Grays out inapplicable signatures as you add new arguments 19
  • 20. Quick Documentation Quick Documentation (Ctrl+Shift+F1):  Shows a pop-up with available doc for any documented symbol  Does so in the text editor, in any ReSharper tool window, or within documentation comments  Provides hyperlinks to detailed information and documentation for related symbols 20
  • 21. Namespace Import Pop-Ups When referencing a non-imported type, ReSharper helps promptly add it to the list of namespace import directives Adding a using directive this way doesnt interrupt your coding session When pasting code from another part of your application, ReSharper will offer to import all required types: 21
  • 22. Live Templates Live templates are predefined code fragments (expressions, constructs, classes, methods etc.) that can be quickly inserted into code By default, ReSharper 5 provides more than 20 live templates for C#, 17 for VB.NET, 6 for ASP.NET and 3 for XML  Iterating through collections  Creating assertion methods  Creating new arrays  Outputting values  Coding LINQ queries  Generating auto-properties 22
  • 23. Surround Templates Surround templates let you select code and surround it with code from a live template (e.g., with a try-catch block) Select the text to surround and press Ctrl+E,Ctrl+U to open up a list of surround templates Use keyboard shortcuts to select one of the templates Choose More… to see all available templates and select which ones appear in the quicklist 23
  • 24. Structural Search and Replace (SSR) SSR lets you create your own patterns to search for code smells, legacy code constructs, etc. Open the patterns catalog in ReSharper | Tools | Patterns Catalog Define your own patterns and what to replace them with ReSharper will highlight instances where pattern matches, and offers the quick-fix for replacement: 24
  • 25. Navigate To Navigate To (Alt+`): context menu that shows all navigation options available at the current caret position: 25
  • 26. Navigate To (cont.) Specifically, you can navigate to:  Declaration  Conflicting declarations  Implementation  Member overloads  Base symbols  Related files  Derived symbols  To-do explorer  Types of symbol  Test explorer  Usages of symbol  Object browser  Control flow target  Metadata view  Function exit(s)  Sources from symbol files  Overriding members  Decompiled sources 26
  • 27. Navigate To (cont.) You can navigate to source files  ReSharper downloads PDBs from located outside your solution the source server…  E.g., .Net Framework Source Code Simply select navigation to external symbol  And displays the source file: 27
  • 28. Call & Value Tracking ReSharper lets you can track…  Inspections indicate all affected Incoming and outgoing locations up/down the call chain: calls to a method (method calls resulting in this call being made, or calls resulting from the call of this method) Origin and destination of values (who provides the value and where it goes) Menu items are available under ReSharper | Inspect 28
  • 29. Generate Generate drop-down menu (Alt+Ins) helps:  Implement and override members  Generate properties  Generate type constructors  Generate delegating members  Generate equality members  Generate formatting members 29
  • 30. Refactor This ReSharper provides 40+ solution-wide refactorings. Refactor This (Ctrl+Shift+R): context menu to view and call refactorings available at a certain code position: 30
  • 31. Find Usages Find Usages (Alt+F7) quickly locates usages of a symbol solution-wide In mixed-language solutions, finds usages multiple languages Search results are displayed in the Find Results window: 31
  • 32. Navigation & Search3 groups of "go to" navigation commands. Group 1: Navigate from anywhere. Commands in this group open in pop- up windows, support CamelHumps and wildcards (* for 0 or more characters, ? for 1 or more characters):  Go to Symbol  Go to Type  Go to File Member  Go to File 32
  • 33. Navigation & Search (cont.) Group 2: Navigate from occurrence of a specific symbol. Navigate from Here is used as a shortcut for these commands:  Go to Declaration  Go to Type Declaration  Go to Base  Go to Inheritor  Go to Usages 33
  • 34. Navigation & Search (cont.) Group 3: Navigate from anywhere within a type:  Go to Next/Previous Member  Go to Containing Declaration+ Go to Last Edit Location navigates to the point of the most recent code modification 34
  • 35. View Recent Edits Recent Edits (Ctrl+Shift+,) is a pop-up window similar to Recent Files that shows files and symbols that you have recently modified: 35
  • 36. Locate in Solution Explorer Locate in Solution Explorer (Shift+Alt+L) highlights the currently opened file in Solution Explorer and auto-scrolls to its entry: It is especially useful in large solutions, or when screen area limitations forces you to shrink the Solution Explorer window to the limit 36
  • 37. File Structure File Structure window (Ctrl+Alt+F) shows members or elements that the current code or markup file contains, and lets you navigate directly to their declarations: 37
  • 38. Type Hierarchy Type Hierarchy (Ctrl+Alt+H at a type usage) shows the inheritance hierarchy of a specified type; its base types and inheritors: 38
  • 39. ReSharper Refactorings The richest set of automated solution-wide refactorings for C# and VB available in Visual Studio ecosystem (40+ refactorings as of R# 5) 200+ context actions = “mini-refactorings” Each code refactoring analyzes the entire scope of the code selection to which it is applied (as wide as whole solution), including cross-language code 39
  • 40. ReSharper Refactorings (cont.) Refactorings can be invoked with:  Individual keyboard shortcuts (whenever available)  Refactor This (Ctrl+Shift+R) context menu that lists contextually available refactorings  ReSharper | Refactor menu  Some refactorings can be triggered with context actions (watch the yellow bulb) If a conflict is detected that prevents running a refactoring, a special warning screen is shown, and the user can modify the code to resolve the issue 40
  • 41. In-Place Refactorings ReSharper can detect when changes in code lead to a refactoring. In this case, the refactoring is offered in-place via a context action. For example, when a variable is renamed, the Rename refactoring is offered in-place: 41
  • 42. Code Cleanup Code Cleanup (Ctrl+E,C) combines customizable code formatting in any scope with a set of other useful actions, including:  Removing code redundancies (C#)  Optimizing namespace import directives (C#, VB.NET)  Reordering type members (C#)  Migrating to C# 3.0/4.0 For example, you can simply run Code Cleanup to remove code redundancies instead of navigating between individual warnings and fixing them one-by-one 42
  • 43. Unit Testing ReSharper recognizes NUnit tests and lets you run or debug them in Visual Studio You can run or debug:  A single unit test  All tests in a test class  All tests in a project  All tests in a solution ReSharper provides two tool windows – Unit Test Explorer and Unit Test Sessions – to view, run and manage unit tests 43
  • 44. Support for ASP.NET MVC Special syntax highlighting for  Dedicated code completion to ASP.NET MVC method calls help you reference actions and and parameters controllers in string literals: Navigation to/from actions and controllers Creation of new controllers and actions from usage 44
  • 45. Support for HTML/CSS/JavaScript ReSharper comes with comprehensive support for HTML, CSS and JavaScript, including  Inspections  Refactorings  Navigation  And a lot more… 45
  • 46. Localization Localizable strings are highlighted  Refactorings (move, rename, and context actions are available inline, safe delete) are available for moving them to resources on resources  A special version of the File Structure window is available for viewing resource files  Resource-specific code inspections are available  Find Usages works naturally on resources  Navigation items “Go to Inheritor” This functionality is available not and “Go to Base” help you move just in code, but also in web apps between culture-neutral and and arbitrary HTML strings culture-specific resource files 46
  • 47. Color AssistanceReSharper helps identify colors in code (C#, VB) andmarkup (XAML, CSS) by using the color to underlinethe identifier:Completion menus are stylized CSS support also comes with ato show colors: dedicated color palette: 47
  • 48. DecompilerNo source? No problem! ReSharper comes with abuilt-in decompiler**Also available separately as dotPeek, see 48
  • 49. Optimize ReferencesReSharper can show you details of how project references areused in your project:Alternatively, you can just quickly remove all unused ones: 49
  • 50. ReSharper Plugins Some of ReSharper plug-ins include:  Gallio: support for MbUnit, MSTest, NBehave, NUnit and xUnit.Net  Agent Smith: validation of XML comments and naming conventions; spell checking in XML comments, string literals, identifiers and resources  Agent Johnson: miscellaneous tools and refactorings  StyleCop for ReSharper: support for Microsoft StyleCop 50
  • 51. Summary: Most Important Shortcuts Alt+Enter: display the list of available quick-fixes and/or context actions Alt+Ins: show code generation options Alt+` (Navigate To): show available navigation options Ctrl+Shift+R (Refactor This): show available refactorings Ctrl+Space (Symbol Completion), Ctrl+Alt+Space (Smart Completion), Shift+Alt+Space (Import Symbol Completion) Ctrl+E,C (Code Cleanup) 51