Little great things about Visual Studio 2019

Mads Kristensen

Mads

A few days ago, we announced the general availability of Visual Studio 2019. But I’ve been using Visual Studio 2019 exclusively since the first internal build – long before the release of Preview 1 in December of 2018. During this time, there has been a lot of little features that have put a smile on my face and made me more productive.

I want to share a few of them with you since they are not all obvious and some require you to change some settings. Let’s dive in.

Clean solution load

When a solution is closed, its state is saved so that next time you open it, Visual Studio can restore the collapsed/expanded state of projects and folders in Solution Explorer and reopen the documents that were left open. That’s great but I prefer a clean slate when I open solutions – no files open and all the tree nodes collapsed in Solution Explorer.

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

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

An added benefit from unchecking these two checkboxes is that solutions will load faster too, because of the eliminated overhead from restoring state. Win-win.

Git pull from shortcut

I do a lot of work with GitHub repos and I often take pull requests from people. That means I must make sure to do a git pull before I make any subsequent commits. But, as it turns out repeatedly, this is something I tend to forget. The result is that I end up with merge conflicts and other nuisances.

The only way to do git pull in the past was to either use Team Explorer, the command line, or an external tool. What I really wanted was a keyboard shortcut from within Visual Studio that did it for me.

Previously, Team Explorer’s pull command was not a command you could assign keyboard shortcuts to but now it is. Go to search (Ctrl+Q) and type “keyboard” to find the Environment > Keyboard options page. From there, find the Team.Git.Pull command from the list. Then assign any shortcut to it and hit the OK button. I chose to use Ctrl+Shift+P.

To automatically perform a git pull upon solution load, try out the free Git Pull extension.

Code Cleanup for C#

Keeping source code neatly formatted and ensuring coding styles are consistent is something I’ve never been good at. The new Code Cleanup feature is a huge help in keeping my code neat and tidy since I have configured it to run all the fixers by default.

To do that, go to the Code Cleanup menu sitting in the bottom margin of the editor window and click Configure Code Cleanup.

In the dialog, select all the fixers one by one from the bottom pane and hit the up-arrow button to move them up into the top. Then hit OK.

Now all fixers will run every time you perform a Code Cleanup. Simply hit Ctrl+K, Ctrl+E to execute. The result is a nicely formatted document with a bunch of coding style rules applied, such as added missing braces and modifiers. Voila!

IntelliCode

IntelliCode is a new feature that augments the IntelliSense completions based on the context you’re in using advanced machine learning algorithms. That proves useful for many scenarios including when you are exploring new interfaces or APIs. I write a lot of Visual Studio extensions and the API surface is so big that there are parts of it I have never used. When I’m exploring a new part of the Visual Studio API, I find it very helpful to have IntelliCode guide me through how to use it.

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

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

See content of Clipboard Ring

Every time you copy (Ctrl+C) something in Visual Studio, it is being stored in the Clipboard Ring. Hitting Ctrl+Shift+V allows you to cycle through the items in the Clipboard ring and paste the item you select. I find it very useful to keep multiple things in the clipboard at once and then paste the various items to specific locations.

In Visual Studio 2019, the Clipboard Ring now shows a visual preview of its content when hitting Ctrl+Shift+V. That makes it easier than ever to navigate through the copy history and select the right item to paste.

New C# Refactorings

There are lots of new and highly useful refactorings in C# that I’ve come to depend on every single day. They show up as suggestions in the light bulb and include moving members to interface or base class, adjusting namespaces to match folder structure, convert foreach-loops to Linq queries, and a lot more.

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

Git Stash

Having the ability to stash away some work for future use is super helpful. Git Stash is what gives me that ability without having to create a new branch. If you’re familiar with TFS, you can think of Git Stash as a shelveset.

The best part is that I can manage all my stashes inside the Team Explorer window. They are easy to create and apply, and I’ve been using them a lot more after Visual Studio now natively supports them.

Try Visual Studio 2019

These were just a few of the many small improvements found throughout Visual Studio 2019 that I find particularly useful. Please share any tips or improvements you’ve found helpful in the comments below!

Mads Kristensen
Mads Kristensen

Senior Program Manager, Visual Studio Extensibility

Follow Mads   

33 comments

Comments are closed.

  • Avatar
    Niels Swimberghe

    Really happy to see we have stashing functionality inside of VS. This was the only feature that I was still using separate Git software for. Great work!

    • Avatar
      Kornelis Pieters

      It is usually easyer to use an extension for VS, that integrates well, than some complete separate software. So before deciding to do the latter, always attempt to find something here first.
      In this case, you would probably have found this here extension, that does a pretty good job of supporting git stash. Of course, if you’ve already migrated to VS 2019, you will not be needing it anymore. But for those that this is not yet an option for: give it a shot 🙂

  • Avatar
    Bernhard Danecker

    The new Code Cleanup feature is quite nice for it’s configurability. But it’s sad that it can not be combined with “Format Document”. In VS2017 there was an option to perform additional code cleanups when formatting documents. This option is no longer available. It would be really nice to see this again.
    My first approach of workaround by assigning the Code Cleanup to the Format Document shortcut wasn’t successful as Code Cleanup is not available in all editors like in razor views. I just want to have one shortcut which performs formatting + cleanup in all available document formats so I don’t have to think about it anymore. 
    I would be very glad if this regression could be fixed 🙂

  • Avatar
    Matteo Contrini

    Is there an ETA for when VS 2019 is going to be available on Azure Dev Tools for Teaching (former Imagine/DreamSpark/MSDNAA)?

    • Mohamed Ali
      Mohamed Ali

      No one of them seems to know or care, one of them said he asked and they told him, in the next few weeks! Well, he said that few weeks ago! 

  • Avatar
    Robin Wilson

    It does seem a bit more responsive and has some nice new touches here and there.
    The part I can’t understand is why SSRS, SSAS and SSIS have to be seperate downloads and can’t be integrated with the main program and checkboxes in the installer as is the case with all other components. Trying to explain to IT depts how to install these seperate tools can be difficult. Before it was two downloads and now with VS 2019 it is 4. It’s like leaving out C# and telling people to have to go to some other website to download it. It is better that there is only one way to install these components rather than two with 2017 where one didn’t install all components properly.
    With VS 2017, updates to SSRS and SSAS often fail as conflict with each other so everything has to be uninstalled and reinstalled again (has happened with all PCs twice in the last 6 months) or SQL Data Tools fails to install and you must extract the VSIX packages and run each manually.
    Is there a valid reason these can’t be available from the installer? I think this would help avoid the reliability issues. Maybe also the illogical messages asking if you want to disable the reporting services plugin to improve performance when you are busy writing a report and would be unable to continue if you followed its advice.

  • Avatar
    John Cardinal

    One of the “Big not-great things about Visual Studio 2019” is the loss of the vertical document well. With that missing, VS2017 remains my preferred tool. The current MS position appears to be “we’ll think about it”, which is not promising. We know we need small, one-responsibility classes, and that means we have a lot of files, and we may have a lot of them open. Without the vertical document well, the doc tabs are a mess. I do not understand how the vertical document well is not a built-in feature, and was not an important-enough feature in the extension to ensure it was ported.

  • Avatar
    Stephen Przepiora

    I’m so glad you guys added Git Stash in, I had to drop development of my extension because we no longer used git and I just didnt have the time to keep a quick and dirty (but useful) extension working, kudos to you guys!

  • Avatar
    Davide Lettieri

    Changing the shortcut Ctrl+Shift+V to show the clipboard history is quite annoying I was faster with the old behavior. New features should have new shortcuts!