ReSharper 2021.3

Visual Studio 2022 지원과 더 많은 C# 10 기능을 추가하고 Nullable 참조 유형 지원을 향상시킵니다.
12월 10, 2021 - 16:22
신규 버전

기능

  • Support for Microsoft Visual Studio 2022
    • ReSharper now supports the release build of Visual Studio 2022. You will have access to the same rich feature set you are already used to having in other Visual Studio versions.
    • Since Visual Studio 2022 is a x64 process, there is no longer a limit to the maximum amount of memory that can be allocated to it. As a result, all ReSharper features work faster.
  • C# 10
    • File-scoped namespaces - In addition to supporting the new syntax itself, a new Syntax style option has been added that allows you to select your desired style. When you choose a style, ReSharper will show you inspections for code that has to be changed to follow the style, and it will suggest the appropriate quick-fixes for you. You can propagate the fixes through the project or even through the whole solution in one click. There are now two context actions that allow you to return your code to the previous syntax style: Convert to file-scoped namespace and Convert to block-scoped namespace.
    • Global usings - ReSharper code analysis is now aware of usings marked with the global keyword, and it uses them to correctly resolve symbols in all the code files in the project. ReSharper will also notify you if a global using has been put in the wrong place in a file. ReSharper will highlight global usings that have no usages in the project as unused, and it will offer a quick-fix to remove the statement.
    • Added rich support for the CallerArgumentExpression attribute - This includes code completion and code inspections to help you use it properly.
    • Interpolated string handlers - C# 10 introduced the new concept of "interpolated string handlers". For end users, this means that string interpolation expressions generally work faster in Microsoft .NET 6, and the new handlers also make it possible to use Span<char> values in interpolation holes. For library authors, this feature allows them to control whether string interpolation expressions are converted to strings. This release recognizes the "interpolated string handlers" pattern in library code and can now safely suggest using string interpolation expressions in more places.
    • Marking record structs as readonly - ReSharper helps you get the best performance out of record structs by suggesting that you mark them as readonly. To avoid cluttering type declarations with modifiers unnecessarily, this inspection is only shown when the record type has non-mutating instance members and there are no mutations via setters in the solution (requires enabled solution-wide analysis).
    • Simplifying pattern matching syntax - C# 10 lets you simplify the pattern matching syntax a bit by allowing dotted access instead of object pattern nesting. ReSharper offers the corresponding inspection with a quick-fix, as well as a context action to undo the quick-fix.
    • Improved support for C# 10 lambdas - Neither red code nor false positive errors are expected in .NET 6 Minimal API projects. As a bonus, ReSharper also helps you use the correct syntax and add parentheses where they’re expected by the compiler.
    • Program as a valid generated class name - ReSharper now supports Program as a valid generated class name for code with top-level statements.
    • Initial support for static abstract members in interfaces is now available - Code analysis considers this construction as valid, which means you should no longer have to deal with red code. The Generate missing members feature is aware of static abstract members and handles them correctly. This release also includes inheritance gutter marks and the ability to navigate to base/derived symbols.
  • Nullable Reference Types - It is not unusual for people to copy pieces of code from other resources, like stackoverflow.com. Nowadays, with nullable reference types available in C#, some code samples already include the NRT syntax. If you don’t have NRT enabled in your solution ReSharper now has two new quick-fixes to help you get rid of this syntax after pasting such code into your project: Replace with JetBrains.Annotations attributes and Remove nullable annotations without ‘#nullable’ context.
    • From time to time, there may be nullability mismatches between type arguments and their nullability constraints. There are now quick-fixes for such cases, including ones that:
      • Remove nullable annotations from type arguments.
      • Remove notnull constraints from type arguments.
      • Allow nullable values in type parameters.
      • Disallow nullable values in type parameters used as type arguments.
    • A bulk quick-fix is now available for correcting annotations on parameters with nullable default values in a file, project, or whole solution.
    • There is also a new bulk quick-fix that makes a parameter nullable if it's checked for null within a method.
  • Code Analysis:
    • Added a couple of new quick-fixes and a context action for static local/anonymous functions with closures:
      • The Allow closures quick-fix removes static modifiers from a local or an anonymous function if it contains closures.
      • The Pass closure as a parameter quick-fix lifts closures in static local functions to parameters.
      • The Pass closure as a parameter context action lifts closures in non-static local functions to parameters.
    • Added a new inspection, Simplify string interpolation, with a corresponding quick-fix that replaces .PadLeft() and .PadRight() method calls with alignment expressions inside interpolated string placeholders.
    • In addition to adding the new C# 10 record struct, support for regular structs has been improved. Many developers still use classes with object initializers for their DTOs. Now you can quickly transform all these usages to constructors with parameters. This can be done either from the record declaration itself or from any object initializer. Note that also DTOs that define a constructor with property assignments can be converted.
    • ReSharper already warned you about inconsistent locks on fields. In this version, a complementary inspection has been added that also takes the order of several locked resources into account, informing you about possible deadlock cycles.
    • ReSharper now checks the plausibility of integral arithmetic expressions for additional integer types, including byte, sbyte, short, ushort, uint, long, ulong, and enum. This helps you avoid unreachable code branches.
    • To make long and complex conditions easier to read, highlighting for condition elements has been added. It highlights groups of logical operators, e.g. && and || chains in C#.
    • Code analysis performance - Reduced the time it takes for quick-fixes and context actions to be implemented when they are invoked for a folder, project, or solution.
      • If Solution-Wide Error Analysis (SWEA) is enabled with Monitor warnings, ReSharper now uses SWEA results to simply skip the files without corresponding issues, greatly reducing the amount of time spent finding issues to fix.
      • ReSharper now utilizes all available CPU cores to run code analysis in parallel. This reduces the overall time it takes to execute scope quick-fixes and context actions.
      • Significantly improved the performance of the daemon for files that contain huge methods, such as the following:
        • Methods with large or nested conditional expressions, tuple expressions, or switch expressions.
        • Methods with lots of type checks when nullable reference types are disabled.
        • Methods with a lot of indexer accesses when nullable reference types are enabled.
        • Methods with a huge number of closures when nullable reference types are enabled.
  • Navigation and Find Usages
    • New gutter marks - Added a few more gutter marks to help you quickly navigate through the inheritance structure of a class, interface, or struct.
      • The new ↑O and ↑I icons show that a code entity inherits or implements another class or interface, respectively.
      • If this code entity’s inheritance is complex, selecting an icon will display a menu with all of its ancestors above it, up to the top of the inheritance hierarchy.
      • If a class implements or inherits an interface and a class simultaneously, ReSharper shows an ↑IO icon in the gutter.
      • Additionally, in this release the gutter mark has been enabled for class members by default.
      • ReSharper will add the ↓O icon in the left gutter next to a class member if the class member is overridden in derived classes. Clicking on the icon will:
        • Navigate you to a member in a derived class that overrides this member.
        • Show you a menu with a list of class members from other classes that override this member.
    • Find Usages for user-defined implicit conversion operators - You can now call Find Usages for user-defined implicit conversion operators. The implementation of this feature is based on the mechanism used for type conversion hints. It allows you to find out whether user-defined implicit conversion operators are used at all, and then navigate to blocks of code with conversions.
      • Please be aware that this algorithm is not fast, and it can take quite some time to calculate and display its findings.
    • Navigate to interface implementations in debug mode - When you invoke 'Go to Type of Symbol' on a variable or parameter of an interface type in debug mode, ReSharper will now take you to the exact implementation of it that is used in the current frame, rather than the interface declaration.
  • Language injections - You can now mark any of a function’s parameters, fields, or properties with the [LanguageInjection] annotation attribute.
    • ReSharper will consider a string value of a marked code entity as a code fragment in a specified language.
    • The following languages can be injected: CSS, HTML, JavaScript, JSON, or XML.
    • As soon as you add the attribute, you will get proper syntax highlighting, code completion, and other features inside the string.
    • You need to add the latest version of JetBrains.Annotations to your project to use the LanguageInjection attribute.
  • Copy Code Reference - This release brings a lot of changes to the Copy FQN feature. The feature now has a new name, Copy Code Reference.
    • New for users of Git version control system - There are GitHub-related items in the Copy Code Reference pop-up out of the box for projects cloned from GitHub. They generate a proper link to a GitHub repository to share it with anyone right away.
    • For non-GitHub repositories - Add custom URI templates in your ReSharper settings - All of these templates will appear in the Copy Code Reference pop-up. A URI template can consist of various predefined placeholders like Current Branch Name, File Name, Current Line Number, etc.
    • Improved the pop-up - The pop-up itself has been given a significant facelift. It’s design, icons, and formatting are all new.
  • Formatting:
    • Added the option to indent lambda or property pattern braces inside statement conditions, such as inside if(), while() etc.
    • Added the option to align statement conditions inside the parentheses in if(), foreach(), etc.
    • Added the option to wrap, chop, align, and outdent binary patterns.
  • Create new Unreal Engine classes
    • With ReSharper C++ 2021.3, you no longer need to switch to Unreal Editor to create a new class. All predefined templates for Unreal Engine classes are now available in the list of ReSharper file templates.
    • To create a new class, go to Solution Explorer and right-click on the preferred project folder to open the Add menu (or use Ctrl+Alt+Insert).
    • After you choose an Unreal Engine template from the list and give your new class a name, ReSharper C++ will generate the header and source files with the template code in the proper folders depending on the private or public context.
  • Even better C++20 support
    • Use C++20 designated initializers to quickly generate boilerplate code for aggregate initialization. Just select the corresponding item from the completion list to insert designators for the data members, and then provide the initial values.
    • ReSharper C++ 2021.3 includes inspections to help you adopt new library functions for erasing elements from any standard container, checking whether an element exists in an associative container, and creating smart pointers with default initialization.
    • Support for AnalyzerConfig files - Starting with the .NET 5 SDK, you can use global AnalyzerConfig files to configure Visual Studio’s analyzer options. ReSharper 2021.3 can read code style information from these global AnalyzerConfig files and use it to adjust ReSharper’s rules accordingly.
ReSharper

ReSharper

귀하의 .NET 생산성을 증가시킵니다.

ReSharper 도 구매할 수 있습니다:

궁금한 점이 있으세요?

JetBrains 사 제품 라이선스 담당자와 라이브 채팅