{"id":224896,"date":"2019-04-04T08:00:25","date_gmt":"2019-04-04T15:00:25","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=224896"},"modified":"2019-04-04T08:28:05","modified_gmt":"2019-04-04T15:28:05","slug":"little-great-things-about-visual-studio-2019","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/little-great-things-about-visual-studio-2019\/","title":{"rendered":"Little great things about Visual Studio 2019"},"content":{"rendered":"<p>A few days ago, we <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-2019-code-faster-work-smarter-create-the-future\/\">announced<\/a> the general availability of <a href=\"https:\/\/visualstudio.microsoft.com\/vs\/\">Visual Studio 2019<\/a>. But I\u2019ve been using Visual Studio 2019 exclusively since the first internal build \u2013 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.<\/p>\n<p>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\u2019s dive in.<\/p>\n<h2>Clean solution load<\/h2>\n<p>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\u2019s great but I prefer a clean slate when I open solutions \u2013 no files open and all the tree nodes collapsed in Solution Explorer.<\/p>\n<p>I wrote the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=MadsKristensen.CleanSolution\">Clean Solution<\/a> 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 (<em>Ctrl+Q<\/em>) and type in \u201c<em>load<\/em>\u201d to find the <em>Projects and Solutions &gt; General<\/em> options page.<\/p>\n<p>Uncheck both the <em>Reopen documents on solution load<\/em> and <em>Restore Solution Explorer project hierarchy on solution load<\/em> checkboxes.<\/p>\n<h2><img decoding=\"async\" class=\"alignnone size-full wp-image-224905\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/solution-load-perf-settings.png\" alt=\"\" width=\"1053\" height=\"710\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/solution-load-perf-settings.png 1053w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/solution-load-perf-settings-300x202.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/solution-load-perf-settings-768x518.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/solution-load-perf-settings-1024x690.png 1024w\" sizes=\"(max-width: 1053px) 100vw, 1053px\" \/><\/h2>\n<p>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.<\/p>\n<h2>Git pull from shortcut<\/h2>\n<p>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 <em>git pull<\/em> 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.<\/p>\n<p>The only way to do <em>git pull<\/em> 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.<\/p>\n<p>Previously, Team Explorer\u2019s pull command was not a command you could assign keyboard shortcuts to but now it is. Go to search (<em>Ctrl+Q<\/em>) and type \u201c<strong>keyboard<\/strong>\u201d to find the <em>Environment &gt; Keyboard<\/em> options page. From there, find the <em>Team.Git.Pull<\/em> command from the list. Then assign any shortcut to it and hit the OK button. I chose to use <em>Ctrl+Shift+P<\/em>.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-224901\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/git-pull.png\" alt=\"\" width=\"1053\" height=\"710\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/git-pull.png 1053w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/git-pull-300x202.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/git-pull-768x518.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/git-pull-1024x690.png 1024w\" sizes=\"(max-width: 1053px) 100vw, 1053px\" \/><\/p>\n<p>To automatically perform a <em>git pull<\/em> upon solution load, try out the free <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=MadsKristensen.GitPull\">Git Pull<\/a> extension.<\/p>\n<h2>Code Cleanup for C#<\/h2>\n<p>Keeping source code neatly formatted and ensuring coding styles are consistent is something I\u2019ve 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.<\/p>\n<p>To do that, go to the Code Cleanup menu sitting in the bottom margin of the editor window and click <em>Configure Code Cleanup<\/em>.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-224900\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/code-cleanup-menu.png\" alt=\"\" width=\"526\" height=\"141\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/code-cleanup-menu.png 526w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/code-cleanup-menu-300x80.png 300w\" sizes=\"(max-width: 526px) 100vw, 526px\" \/><\/p>\n<p>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.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-224899\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/code-cleanup-configuration.png\" alt=\"\" width=\"1030\" height=\"740\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/code-cleanup-configuration.png 1030w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/code-cleanup-configuration-300x216.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/code-cleanup-configuration-768x552.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/code-cleanup-configuration-1024x736.png 1024w\" sizes=\"(max-width: 1030px) 100vw, 1030px\" \/><\/p>\n<p>Now all fixers will run every time you perform a Code Cleanup. Simply hit <em>Ctrl+K, Ctrl+E<\/em> 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!<\/p>\n<h2>IntelliCode<\/h2>\n<p>IntelliCode is a new feature that augments the IntelliSense completions based on the context you\u2019re 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\u2019m exploring a new part of the Visual Studio API, I find it very helpful to have IntelliCode guide me through how to use it.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-224903\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/intellicode.gif\" alt=\"\" width=\"1064\" height=\"416\" \/><\/p>\n<p>To enable this powerful feature, you can download <a href=\"https:\/\/aka.ms\/vs-ic\">IntelliCode<\/a> from the Visual Studio Marketplace and install the extension.<\/p>\n<p>IntelliCode works for C#, C++ and XAML.<\/p>\n<h2>See content of Clipboard Ring<\/h2>\n<p>Every time you copy (<em>Ctrl+C<\/em>) something in Visual Studio, it is being stored in the Clipboard Ring. Hitting <em>Ctrl+Shift+V<\/em> 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.<\/p>\n<p>In Visual Studio 2019, the Clipboard Ring now shows a visual preview of its content when hitting <em>Ctrl+Shift+V<\/em>. That makes it easier than ever to navigate through the copy history and select the right item to paste.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-224898\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/clipboard-preview.png\" alt=\"\" width=\"826\" height=\"150\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/clipboard-preview.png 826w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/clipboard-preview-300x54.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/clipboard-preview-768x139.png 768w\" sizes=\"(max-width: 826px) 100vw, 826px\" \/><\/p>\n<h2>New C# Refactorings<\/h2>\n<p>There are lots of new and highly useful refactorings in C# that I\u2019ve 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.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-224904\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/refactorings.gif\" alt=\"\" width=\"1012\" height=\"412\" \/><\/p>\n<p>To learn more about the new refactorings and other C# features in Visual Studio 2019, check out <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/visual-studio-2019-net-productivity\/\">this post on the .NET blog<\/a>.<\/p>\n<h2>Git Stash<\/h2>\n<p>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\u2019re familiar with TFS, you can think of Git Stash as a shelveset.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-224902\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/git-stash.png\" alt=\"\" width=\"584\" height=\"693\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/git-stash.png 584w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2019\/04\/git-stash-253x300.png 253w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/><\/p>\n<p>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\u2019ve been using them a lot more after Visual Studio now natively supports them.<\/p>\n<h2>Try Visual Studio 2019<\/h2>\n<p>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\u2019ve found helpful in the comments below!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few days ago, we announced the general availability of Visual Studio 2019. But I\u2019ve been using Visual Studio 2019 exclusively since the first internal build \u2013 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.<\/p>\n","protected":false},"author":642,"featured_media":224901,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[294,12],"class_list":["post-224896","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-extensions","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>A few days ago, we announced the general availability of Visual Studio 2019. But I\u2019ve been using Visual Studio 2019 exclusively since the first internal build \u2013 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.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/224896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/642"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=224896"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/224896\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/224901"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=224896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=224896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=224896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}