Visual Studio 2019 Preview .NET Productivity
As you hopefully heard, the first preview of Visual Studio 2019 is now available. In this post I’ll cover some of the productivity improvements for .NET developers we’re most excited about. For a complete list, check out the release notes.
Regex Language Support
Any regular expressions in your C# or Visual Basic files now have syntax highlighting, compiler diagnostics, and code fixes! This parsing support can recognize strings passed to the regex constructor and strings immediately preceded with a comment containing the string `language=regex`. The language features currently included in this release are classification, brace matching, highlight references, and compiler diagnostics.
Export editor settings to Editorconfig
You can now export editor settings to an Editorconfig file through Tools > Options > Text Editor > C# > Code Style with the button “Generate .editorconfig file from settings”.
Code Fixes and Refactorings
We added several of the top-requested code fixes and refactorings in Visual Studio 2019 Preview 1. Many were implemented by the community so hats off to our awesome contributors! Refactorings and quick actions are available using (Ctrl + .) or (Alt + Enter).
Foreach loop to LINQ query
Foreach loops to LINQ queries or LINQ methods now join the other loop refactoring options including converting LINQ to Foreach, For loop to Foreach, and Foreach to For loop.
Add “Using” Statement on copy/paste
Convert anonymous type to class
Convert local function to method
More new code fixes and refactorings:
- Convert tuple to a named-struct.
- Dead code analysis for unused private members with an optional code fix to remove unused member declaration.
- Generate a deconstruct method.
- Add “await” where it is implied, but there is no compiler warning.
View all the code fixes and refactorings for .NET in our docs.
Document health indicator
The document health indicator allows you to look in one place to know if code style errors or warnings are present in the file you have open and makes it easy to jump to them. The indicator appears in the bottom right corner of your code editor making it easy to access code style configurations and run code cleanup.
Find All References and CodeLens Razor support
Find All Reference (Shift-F12) and CodeLens now show results from Razor (.cshtml) files in .NET Core projects. You can then navigate to the identified code in the relevant Razor files.
Run tests from Solution Explorer
You can now right-click on tests, test classes, or test projects in the Solution Explorer to run or debug tests.
As always, thank you for trying out previews, giving feedback on Developer Community, and using the Report a Problem tool in Visual Studio. Read more or watch a video on other Visual Studio 2019 Preview 1 features in the blog post.
Finally! A blog post that uses actual videos instead of animated GIF! 😍 You have no idea how useful it is to pause those videos, rewind them and see exactly what happened.
Thanks a lot. 👍