Over the last few updates to Visual Studio 2017, we’ve been hard at work adding new features to boost your productivity while you’re writing code. Many of these are the result of your direct feedback coming from the UserVoice requests, Developer Community tickets, and direct feedback we’ve encountered while talking to developers like you.
We are so excited to share these features with you and look forward to your feedback!
One of our top UserVoice items asked for the ability to create multiple insertion and selection points, often shortened to be called multi-caret or multi-cursor support. Visual Studio Code users told us they missed this feature when working in Visual Studio. We heard you opened single files in Visual Studio Code to leverage this feature or installed extensions such as MixEdit, but in Visual Studio 2017 Version 15.8, you won’t need to do this anymore. We’ve added native support for some of the top requested features in the multi-caret family and we’re just getting started.
There are three main features we’d like to highlight. First, you can add multiple insertion points or carets. With Ctrl + Alt + Click, you can add additional carets to your document, which allows you to add or delete text in multiple places at once.
Second, with Shift + Alt + . you can add additional selections that match your current selection. We think of this as an alternative to find and replace, as it allows you to add your matching selections one by one while also verifying the context of each additional selection. If you’d like to skip over a match, use (Ctrl + Shift + Alt + .) to move the last matching selection to the next instance.
Lastly, you can also grab all matching selections in a document at once (Ctrl + Alt + Shift + ,) providing a scoped find and replace all.
Just like papercuts, smaller missing commands hurt when you add them up! We heard your pain, so in the past few releases, we’ve tried to address some of the top features you’ve asked for.
The reduction of even a single keystroke adds up when multiplied across our userbase and one place we saw an opportunity to optimize your workflow was in duplicating code. The classic Copy + Paste worked in many cases, but we also heard in feedback that you wanted a way to duplicate a selection without affecting your clipboard. One scenario where this often popped up was when you wanted to clone a method and rename it by pasting a name you had previously copied.
To solve this issue, we introduced Duplicate Code (Ctrl + D) in Visual Studio 2017 version 15.6 which streamlines the process of duplicating your code while leaving your clipboard untouched. If nothing is selected, Ctrl + D will duplicate the line the cursor is in and insert it right below the line in focus. If you’d like to duplicate a specific set of code, simply select the portion of code you want to duplicate before invoking the duplicate code command.
How do you quickly select a code block? In the past, you could incrementally add to your selection word by word or perhaps you used a series of Shift plus arrow keystrokes. Maybe you took that extra second to lift you hand off the keyboard so you could use a mouse instead. Whatever the way, you wanted something better. In Visual Studio 2017 version 15.5, we introduced expand /contract selection which allows you to grow your selection to the next logical code block (Shift + Alt + +) and decrease it by the same block if you happen to select too much ((Shift + Alt + –).
Moving between issues in your document
You’ve been able to navigate to Next Error via Ctrl + Shift + F12 but we heard this experience was sometimes jarring as Next Error might jump you all around a solution as it progressed through issues in the order they appeared in the Error List. With Next/Previous Issue (Alt + PgUp/PgDn) you can navigate to the next issue (error, warning, suggestion) in the current document. This allows you to move between issues in sequential versus severity order and gives you more progressive context as you’re moving through your issues.
Go To All – Recent Files and File Member search
You can now view and prioritize search results from recent files. When you turn on the recent files filter, the Go To All results will show you a list of files opened during that session and then prioritizes results from recent files for your search term.
Additionally, Go To Member is now scoped to the current file by default. You can toggle this default scope back to solution level by turning off Scope to Current Document (Ctrl + Alt + C).
Go To Last Edited Location
We all know the feeling of starting to write a feature and then realizing we need some more information from elsewhere in the solution. So, we open another file from Solution Explorer or Go to Definition in a few places and suddenly, we’re far off from where we started with no easy way back unless you remember the name of file you were working in originally. In Visual Studio 2017 version 15.8, you can now go back to your last edited location via Edit > Go To > Go To Last Edit Location (Ctrl + Shift + Backspace).
Keyboard profiles for Visual Studio Code and ReSharper
Learning keyboard shortcuts takes time and builds up specific muscle memory so that once you learn one set, it can be difficult to retrain yourself when the shortcuts change or create mappings that match your previous shortcuts. This problem came to light as we heard from users who frequently switch between Visual Studio and Visual Studio Code, and those who used ReSharper in the past. To help, we’ve added two new keyboard profiles, Visual Studio Code and ReSharper (Visual Studio), which we hope will increase your productivity in Visual Studio.
C# Code Clean-up
Last, but certainly not least, in Visual Studio 2017 version 15.8, we’ve configured Format Document to perform additional code cleanup on a file–like remove and sort usings or apply code style preferences. Code cleanup will respect settings configured in an .editorconfig file, or lacking that rule or file, those set in Tools > Options > Text Editor > C# > [Code Style & Formatting]. Rules configured as none in an .editorconfig will not participate in code cleanup and will have to be individually fixed via the Quick Actions and Refactorings menu.
Update and Give Feedback
With Visual Studio Version 15.8, you’ll have access to all the features above and more so be sure to update to take advantage of everything Visual Studio has to offer.
As you test out these new features, use the Send Feedback button inside Visual Studio to provide direct feedback to the product team. This can be anything from an issue you’re encountering or a request for a new productivity feature. We want to hear all of it so we can build the best Visual Studio for you!
|Allison Buchholtz-Au, Program Manager, Visual Studio Platform
Allison is a Program Manager on the Visual Studio Platform team, focusing on streamlining source control workflows and supporting both our first and third party source control providers.