A recent project to do Anne Flower just came into contact with the IDE's Reshaper plugin, and had to say too much to like it. Reshaper Rich features have reached the extent of the Ox X. I can only say that after the use of all said!
Every good one. NET programmers should learn and explore its rich features!
One: What is Reshaper?
ReSharper is an editor developed by JetBrains for C #, Asp.net,vb.net, XML, and XAML. In line with the tradition of jetbrains development tools, ReSharper has highly intelligent error correction, more than 30 advanced code refactoring capabilities, convenient unit testing tools, quick navigation, retrieval, and a number of features such as one-click Format Code, automatic code generation, and template functionality.
RELATED LINKS
- ReSharper Detailed Introduction: Please click here Baidu Introduction: Here
- ReSharper: Please click here to charge no problem, we only use cracked
Two: ReSharper Key Features
2.1 C # 3.0 Depth Analysis
ReSharper analyzes your code listening errors and warnings for the entire solution, and highlights them when you are in real time (as you type). For most errors, it immediately gives a way to solve the problem through smart remediation. It can also give coding suggestions and clues, which provide insight into the code structure and logic and make you aware of potential design errors. You can also annotate your code to make ReSharper better analyze your code.
ReSharper provides comprehensive support for c#3.0, including LINQ, implicitly-typed local variables and arrays, extension methods, automatic attributes, lambda expressions, initialization of objects and collections, anonymous types, expression trees, and partial methods. Whenever there is an error or invalid code in your code, ReSharper will let you know right away.
Read more about C # code Analysis
2.2
Advanced Code Assistance
ReSharper provides many shortcuts for simplifying code tasks to increase your productivity and save you time. In the screenshot above, ReSharper Smart recommends that you add the missing using or import the correct full name when you enter the type name. It can use different code templates to quickly generate code, view the types and their members ' documents in the editor, perform code conversions using a context action called "contextual actions", and much more.
ReSharper uses three types of code completion to extend and improve the intelligence of Visual Studio itself. The identity completion recommendation only accesses types in the current scope. Smart completion tasks are very effective, filtering member methods and variables in real time to match the expressions you enter. Import symbol completion makes it possible to complete a type name name and extension method in the current project. It also automatically adds the appropriate using reference when needed. In addition to the statement completion, a simple shortcut key can be used to automatically add the necessary grammatical elements (curly braces, semicolons, etc.), and put the cursor in the appropriate position to start the next sentence.
Read more about ReSharper's Advanced code assistance
2.3 Numerous code refactoring
In Visual Studio environments, ReSharper provides rich automatic code refactoring capabilities for C # and Visual Basic.
Change signature |
Copy type |
Make a method non-static (unshared) |
Change an abstract class to an interface |
Encapsulate Fields |
To make a method static (shared) |
To convert an anonymous type to a named type |
Extracting a class from a parameter |
Moving static members |
The transform extension method is a simple static method |
Extraction interface |
Move a type to another file or namespace |
Convert index (default property) to method |
Extraction method |
Move the type to the outer layer |
Transform interface to abstract class |
Extracting Super Class |
Pull the member to the base class |
Conversion method to index (default property) |
Inline ① method |
Put a member in a subclass |
Conversion method is property |
Inline variable/Field |
Renaming |
Convert properties to Automatic properties |
Introduce fields |
Replacing constructors with factory methods |
Convert property to Method |
Introducing Parameters |
Safe removal |
Convert static methods to extension methods |
Introducing variables |
If possible, use the base class |
Each code refactoring analyzes the entire range of selected applications (which may be your entire solution), including cross-language code, which modifies the code structure in the most intelligent way possible. You can rename, move, safely delete identities, import and inline ① fields, variables and parameters, convert properties to automatic properties and methods, convert static methods to extension methods, and so on. In addition, the use of quick fixes and contextual actions makes it possible to convert a variety of simple code (just for convenience and availability).
①: Here, inline means embedding the method body of a variable or method defined outside the code directly in use.
Read more about refactoring C # and vb.net code with ReSharper
2.4 Navigating and searching
Whenever you need to find a type, field, method, or any other identity, ReSharper provides a number of implementations that can find an identity by name, find and highlight the identity usage when the code navigates from the reference location to the identity's declaration location. You can use a simple shortcut in your current location to implement all navigation behaviors that are available.
In addition, using the Special tool window integrated into the Visual Studio user interface, ReSharper lets you see the full type Inheritance tree and file structure.
ReSharper has extended a series of navigation and search features to recent edits-a drop-down list of files or identities that you recently modified.
Read more navigation and search
2.5 Code Cleanup
Code cleanup is a shortcut to dozens of ReSharper features (code Cleanup is a shortcut for a dozen of ReSharper features), which arranges the "this" qualifier according to the custom style formatting code, Remove redundant code, convert the field to an automatic attribute based on the alternate field, make the fields read-only, optimize the using command, properly simplify the reference, update the file header, replace the explicit type with VARs, or modify your C # code with more settings.
For vb.net, optimize the import command, properly simplify the reference, and format your code according to the format style. You can do code cleanup in batch mode, so you can immediately clean up your entire project or even your solution.
Read more about Code cleanup
2.6 Cross-language features
To mix C # and vb.net projects, ReSharper helps you keep parts of your code working together smoothly and navigating between your code easily.
All navigation and search actions take into account the code for all languages, including c#,vb.net,asp.net, and XAML. You can navigate to use, declaration, inheritance, base class and more-cross language. Automatic reference corrections are made whenever possible, using refactoring, contextual actions, or rapid modifications that cover two major languages. Unit tests are available and are the same regardless of whether you write unit tests using C # or vb.net.
Read more ReSharper cross-language features
2.7 asp . NET Support
With error highlighting, quick fixes, contextual actions, code assistance, navigation, refactoring, and other features, you can now edit ASP. net files in a pleasant and efficient. With ReSharper, you can edit and refactor C # code, such as Web control properties and events, data sources, and content-point characters in ASP.
Read more ASP. NET Support
2.8 XML Support
ReSharper provides some time-saving XML features, including type completion, navigating to reference types, highlighting, replacing and moving labels, navigating between two tabs and opening/closing tags, using code assistance and live templates.
Read more about XML support
2.9 XAML Support
XAML features include XML editing in XAML code, all ReSharper code completion features, several refactoring (including rename refactoring), and real-time error hinting, semantic and syntactic parsing. The above screenshot shows the work of agile code completion in XAML resources.
Read more about XAML support
2.1 Integrated Unit Testing
ReSharper detects unit tests in the Code and provides complete unit test support. You can run and debug tests from the Code Editor. Also, a dedicated Unit Test Resource window lets you see the structure of your unit tests and any combination of tests that run one or many unit test sessions.
Read more ReSharper unit tests
2.11 Nant and Ms build script editing
Advanced editing performance (editing capabilities), previously only available for C #, now extends to Nant and MSBuild scripts, providing complete code assistance for generating scripts, a large number of navigation and search features, file structures, Real-time error highlighting and quick changes.
Read more Nant and Ms build script edits
To get the completed ReSharper feature description, browse the ReSharper feature page.
This tool can reduce the time you spend on regular transactions and repetitive manual labor, giving you more time to focus on your existing tasks. Its numerous automatic error checking and code correction features reduce development time and increase your productivity. You will find that ReSharper will quickly compensate for the cost of its purchase by improving development efficiency and improving code quality. Using Resharper,.net developers will experience what is "enjoyable development".
Two-1: Set
1.1 Smart Tips
After the installation is complete, the IDE's Smart Tip (IntelliSense) will use the Resharper hint by default, and I don't know why, I've never liked the hint. Change it, in the option window:
1.2 Shortcut keys
It is strongly recommended that you use Reshaper shortcut keys, do not worry about Reshaper will put your original shortcut key set to overwrite, because if a shortcut key and VS is conflict, Reshaper will let you choose to use VS or Resharper shortcut keys, see the following interface:
Note, do not choose Apply to all Reshaper shortcuts, if you choose, this interface will no longer appear, and generally, you will prefer to make your own decision in the conflict.
Of course, if you must use the VS original shortcut key, then you should select the option in the window below the red box, then shake the hand, point to Save:
1.3 Integration with STYLECOP
If we install StyleCop (http://stylecop.codeplex.com/) at the same time, Resharper will integrate to indicate whether your current code conforms to your STYLECOP settings.
PS: The following configurations are based on STYLECOP 4.7 and Reshaper 7.1.3. In some cases, the older version of the STYLECOP and reshaper are not integrated so that you cannot use the Resharper hint on the path of the code specification.
After integration, we can Add a new rule in the Code Eidting-〉code Cleanup interface of the option interface, and then, in the new rule, you can see the STYLECOP option, as follows:
After these settings, the IDE will be prompted according to the criteria of this setting, as follows:
1.4 Reshaper stylecop Set rule and StyleCop itself set rule conflict problem
StyleCop familiar with the code of Friends are aware that if your project set the STYLECOP itself rules, STYLECOP will generate a setup document, as follows:
So, can Reshaper's StyleCop set rules and StyleCop's own set rules become one? The answer is: I'm sorry, no! You have to set it at both ends to make it consistent. so to me, reshaper that hint or codeclean is just an auxiliary means, stylecop that "Run StyleCop" is the final submission criteria.
1.5 What should I do if I don't like a hint?
Yes, you can modify the settings. As follows:
In this case, I don't like to hint at the variable starting with the underscore as warning, we can choose the bottom change settings ... To make changes, select the following:
As you can see, we modify the prefix to add.
Three: Universal Alt + Enter
If we use the Reshaper shortcut setting, then, at each prompt, click ALT + Enter key combination, will pop up Resharper suggest you want to do, such as:
In this tip, Reshaper tells us that there is no reference to the System.Text namespace, and this time, clicking Alt + Enter will automatically use the namespace;
3.1 Auto-complete syntax sugar
Another example:
Alt+enter the key combination on StringBuilder, you will be prompted to use Var here.
Or, for example, if you use a combination key on if, you will be prompted with the ternary operator:
In short, Alt + Enter is omnipotent, see the hint, use it, you will often get meaningful help to improve the quality of your code. Some of the complex LINQ you won't write, using Alt+enter will automatically help you convert some of the code into a very forked LINQ, as if you were a LINQ master;
3.2 Hints
This little light is a hint, if you do not want to use ALT + Enter, you can use the mouse to poke here, there will be Resharper suggestions.
Four: Find Usage
In a class, or in a variable, or on a method, the Find Usage, or the stamp shortcut ALT + F7, is the place where all of your selected classes or variables or methods are referenced. In other words, the search and look-up references after VS2012 are simply too weak to explode. In short, this feature is also a highlight of reshaper.
In particular, we note that in the picture, it will be you many times to find the form of a tab to keep you, we are in the analysis of the code, often a one-time lookup of multiple variables of the reference, at this time, it is particularly helpful. In short, this feature is necessary and very programmer.
V: File Structure
Also, is it annoying to look at the structure of the class to poke this drop-down box:
At this time, you press the key combination CTRL + F11, the Resharper File Structure window appears:
It is convenient for you to see your entire member variable window.
6:0-like reconstruction
A programmer who always writes the perfect code is always in the mind of an idiot leader, as we all know that code is reconstructed and never designed. So, you'll always need Ctrl + Shift + R:
Resharper Lists the refactoring methods you might use, either by moving the keyboard or the mouse, and you're ready to reconstruct it instantly.
Seven: quick-to-complete code
With the IntelliSense and tab keys provided by VS, the ability to quickly complete code, such as entering code prop, and then pressing the TAB key, automatically creates a property, but Resharper provides additional options that look like more code to complete.
Press the key combination Alt + Insert, the following window appears:
I've never used the VS method to automate the creation of a constructor, and it's easy to do this with Resharper.
Eight: Cleanup Code
After writing a wo consulted class, what is the most enjoyable, is to let it in the way and change the specification, this time, we need to right-click Cleanup Code (Ctrl + Alt + F):
Resharper provides a choice for us to set Cleanup code specification, of course, because we have introduced the STYLECOP, so this specification can be set up very convenient.
PS: The above belongs to the development of commonly used reshaper function, this article is used for training members to use Reshaper, focusing on the issue of the shortcut key conflict and STYLECOP combination with the problem.
Reference: http://www.cnblogs.com/renji/archive/2007/12/11/resharper.html
Shortcut keys for Reshapter 7:
Resharper Introduction-Installation-Feature show