The C# and Visual Basic Code-Focused IDE Experience
The new C# and Visual Basic code-focused IDE experience in the Visual Studio 2015 Preview is significantly improved over the experience in Visual Studio 2013 and I’m excited to share some highlights with you. We’ll look at a few key areas:
Refreshed Core IDE Experiences – your existing coding experience just got better
Code Fixes and Refactorings – improve your code with live code analysis and refactorings
Inline Rename – increase your productivity with a brand new Rename experience
Many of the new and refreshed features that I describe below come to us by way of the .NET Compiler Platform (formerly codenamed “Roslyn”), our rebuild of the C# and Visual Basic compilers and IDE experiences.
Refreshed Core IDE Experiences
The C# and Visual Basic IDEs are made up of dozens of features that developers use every day, such as syntax highlighting, IntelliSense, and refactoring support. While rebuilding them, we were careful to ensure that, for the most part, features operate in the same way as they did before to avoid breaking your muscle memory. However, we also kept our eyes open for improvements we could make along the way. The end result is a refreshed coding experience that feels more modern and enhanced – our goal is that core IDE features just feel better than they did before.
Let’s look at a simple example.
Colorized ToolTips. Visual Studio has supported collapsible outlining in the editor for more than a decade: VS automatically creates collapsible regions for various language constructs, such as class and method bodies. When collapsed, you’ve always been able to hover over them to see the hidden code presented in a plain text tooltip.
As we rewrote this feature, we thought about how we could improve it, so in Visual Studio 2015, the tooltip now displays the code in full color and even shows the full declaration to provide more context.
Figure 1 Visual Studio 2015 Preview
We’re sure you’ll agree that’s a big step up from the Visual Studio 2013 experience.
Figure 2 Visual Studio 2013 Update 4
Of course, we didn’t just stop with outlining. We carried this idea into the tooltips you see when hovering over a symbol (even adding a glyph):
And Parameter help is colorized now too:
This is a small example but is representative of the many improvements we’ve made to the core IDE features.
Code Fixes and Refactoring
Today, live static code analysis and automated code refactoring are a staple in modern IDEs, and Visual Studio is no exception. With the C# and Visual Basic support in Visual Studio 2015 we’ve gone a step further.
As you write C# or Visual Basic code with Visual Studio 2015, you’ll see many live static code analysis improvements. For example, unused using directives or Imports statements fade into the background.
Hovering over an error or warning in the editor will often show a light bulb along with a tooltip explaining the problem. The light bulb tells you there are potential fixes for the problem.
Or, if you prefer the keyboard, you can press CTRL+<dot> (i.e., CTRL and the period key) to display the light bulb.
What’s extremely powerful about the light bulb experience is the live code preview that shows a handy inline diff of what will happen to your code if you apply an action. Armed with this, you can apply code fixes and refactorings with confidence.
New Refactoring Support
VS 2015 ships two new refactorings: Introduce Explaining Variable and Inline Temporary Variable. These augment the existing set offered in for C# (e.g. Rename, Extract Method, and Encapsulate Field). More than that, we’ve made refactoring extensible, so the community can build all sorts of other fixes and refactorings as well.
To apply a refactoring, move the editor caret to or select a relevant piece of code and press CTRL+<dot>. This should display a light bulb with the relevant refactoring actions available to you. Alternatively, you can right-click in the editor and choose “Quick Actions” from the context menu.
Finally, Visual Basic refactoring support is available in-the-box for the first time. All refactorings available in C# are also available in Visual Basic.
One particular C# and Visual Basic refactoring is used so often that we’ve given its experience a full makeover: Rename.
In previous versions of Visual Studio, when you performed a Rename you would be presented with a dialog where you could provide a new name. Once you supplied a name and accepted the dialog, the Rename refactoring would then go off to find all of the references to rename and do tons of work, taking minutes on a large solution.
For Visual Studio 2015, we’ve removed the dialog and made rename work inline in the editor so you can stay focused on your code. Just press the keyboard shortcut bound to Rename (F2 in the C# settings or Ctrl+R, R in the general settings) and start typing. All of the matching references are updated live as you type and you can press ENTER to commit the change.
To help you make changes with rename confidently, it detects conflicts as you type:
It can even resolve conflicts automatically, making changes on your behalf:
This should give you a taste of some of the new IDE experiences for C# and Visual Basic. I’ve only been able to scratch the surface here, but there’s a lot more in Visual Studio 2015. Download the Visual Studio 2015 Preview, give it a whirl, and let us know what you think.
As always, please give us your feedback, suggestions, thoughts, and ideas on our UserVoice site, through the in-product Send-a-Smile and Send-a-Frown UI, or file a bug through the Visual Studio Connect site. We’re also making it easier in the Visual Studio 2015 Preview to send more detailed bug reports and repro steps. Just go to Help->Feedback->Send a Frown directly within Visual Studio.