Cool features of Visual Studio 2019

Original author: Mads Kristensen
  • Transfer
A few days ago, we announced the general availability of Visual Studio 2019. Personally, I have been using Visual Studio 2019 since the first internal build - long before Preview 1 was released in December 2018. During this time, many small features were found that made me smile and made my work more productive.

I want to share some of them with you, because they are not all obvious, and some require some settings to be changed. Details under the cut!



Thank you for translating our MSP, Lev Bulanov .

Download Clean Solution


When the solution is closed, its state is saved, and the next time you open it, Visual Studio will be able to restore the minimized / expanded state of the projects and folders in the Solution Explorer and reopen the documents left open. This is great, but I prefer a blank sheet when I open the solutions - the files do not open, and all the tree nodes in the solution explorer collapse.


I created the Clean Solution extension to provide this behavior in a previous version of Visual Studio. This feature is now built into Visual Studio 2019 and can be enabled with two separate checkmarks. Go to the search (Ctrl + Q) and type load to find the Projects and Solutions> General options page.

Uncheck the Reopen documents on solution load and Restore Solution Explorer project hierarchy on solution load.


An additional advantage of removing these two checkmarks is that the solutions will load faster due to the elimination of overhead during recovery. Win-win.


Git pull keyboard shortcut


I work a lot with GitHub repositories and often accept requests from people. This means that I have to do git pull before making subsequent commits. But, as it turned out more than once, this can easily be forgotten. As a result, I came across merge conflicts and other troubles.

In the past, the only way to do git pull was to use Team Explorer, a command line, or an external tool. What I really wanted to get was a keyboard shortcut in Visual Studio that would do this for me.

Previously, the pull command in Team Explorer was not a command that can be assigned keyboard shortcuts, but now it is. Go to search (Ctrl + Q) and type “keyboard” to find the Environment> Keyboard page. In it, find the Team.Git.Pull command in the list. Then assign it any combination and click OK. I decided to use Ctrl + Shift + P.


To automatically perform git pull when loading a solution, try the open Git Pull extension .


Code Cleanup for C #


Maintaining neatly-formatted source code and ensuring consistency in coding styles is something I've never been good at. The new Code Cleanup feature helps a lot to keep my code clean and tidy, as I configured it to run all the default fixes.

To do this, go to the Code Cleanup menu located at the bottom of the editor window and click Configure Code Cleanup.


In the dialog box, select all the latches one by one on the bottom panel and click the up arrow button to move them up. Then click OK.


Now all latches will be triggered every time you clean up the code. Just press Ctrl + K, Ctrl + E to execute. The result is a well-formatted document that uses a set of coding style rules, such as adding missing brackets and modifiers. Voila!

IntelliCode


IntelliCode is a new feature that extends IntelliSense depending on the context in which you use advanced machine learning algorithms. This is useful for many scenarios, including when learning new interfaces or APIs. I am writing many Visual Studio extensions, and the diversity of the API is so great that there are parts that I have never used. When I learn a new part of the Visual Studio API, I find it very useful that IntelliCode tells me how to use it.


To enable this powerful feature, you can download IntelliCode from the Visual Studio Marketplace and install the extension.

IntelliCode works with C #, C ++ and XAML.

View clipboard ring content


Each time you copy (Ctrl + C) something in Visual Studio, it is saved in the Clipboard Ring. The keyboard shortcut Ctrl + Shift + V allows you to cycle through the elements in the Clipboard Ring and insert the selected element. I find it very useful to store several things on the clipboard at the same time, and then paste various elements in certain places.

In Visual Studio 2019, the Clipboard Ring now shows a visual preview of its contents when you press Ctrl + Shift + V. This makes it easy to navigate through the copy history and select the desired item to insert.


New C # refactoring


C # has a lot of new and very useful refactoring that I used every day. They are displayed as light bulb tips.


To learn more about the new refactoring and other C # features in Visual Studio 2019, check out this .NET blog post .


Git stash


Being able to put off some work for the future can be very useful. Git Stash is what gives me this opportunity without having to create a new branch. If you are familiar with TFS, then Git Stash is very similar to shelveset.



The best part is that I can manage all my notes in the Team Explorer window. They are easy to create and use, and I began to use them much more after Visual Studio started supporting them by default.


Try Visual Studio 2019


These were just a few of the many enhancements added in Visual Studio 2019 that I find particularly useful. Please share your life hacks or improvements that you find helpful in the comments below!


Download Visual Studio 2019
 
Mads kristensen
Mads kristensen

Senior Program Manager, Visual Studio Extensibility


Also popular now: