📜 ⬆️ ⬇️

Powerful features of Visual Studio 2019

A few days ago we announced the general availability of Visual Studio 2019. Personally, I have been using Visual Studio 2019 since the first in-house build, long before the release of Preview 1 in December 2018. During this time, many small features were discovered 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 changing some settings. Details under the cut!


')
Thanks for the transfer to our MSP, Lev Bulanov .

Clean Solution Download


When a 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 projects and folders in the Solution Explorer (Solution Explorer) and re-open left open documents. This is great, but I prefer a clean slate when I open a solution — the files do not open, and all the nodes in the tree in the solution browser are minimized.


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 by two separate checkmarks. Go to the search (Ctrl + Q) and type load to find the Projects and Solutions> General options page.

Uncheck Reopen documents on solution load and Restore Solution.


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


Git pull 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 repeatedly, it can be easily forgotten. As a result, I was confronted with merger conflicts and other troubles.

In the past, the only way to do git pull was to use Team Explorer, the 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 team of pull in Team Explorer was not a team that can assign keyboard shortcuts, but now it is. Go to the search (Ctrl + Q) and enter “keyboard” to find the Environment> Keyboard page. In it find team Team.Git.Pull 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 #


Keeping 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, since I configured it to run all fixers by default.

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 fixers will be launched each time you perform code cleanup. Just press Ctrl + K, Ctrl + E to complete. The result is a well-formatted document that applies a set of encoding style rules, such as adding missing parentheses and modifiers. Voila!

Intellicode


IntelliCode is a new feature that extends IntelliSense capabilities depending on the context in which you use advanced machine learning algorithms. This is useful for many scenarios, including when exploring new interfaces or APIs. I write a lot of Visual Studio extensions, and the diversity of the APIs is so great that there are parts that I have never used. When I learn the 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 Contents


Every 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 paste the selected element. I find it very useful to store several things in the clipboard at the same time, and then paste various items into specific places.

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


New C # refactorings


In C # there are many new and very useful refactorings that I used every day. They are displayed as tips in the form of a light bulb.


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


Git stash


The ability to postpone 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 some of the many enhancements added in Visual Studio 2019, which I find particularly useful. Please share your life hacking or improvements that you find useful in the comments below!


Download Visual Studio 2019

Mads kristensen
Mads kristensen

Senior Program Manager, Visual Studio Extensibility

Source: https://habr.com/ru/post/447124/


All Articles