다음을 통해 공유


15 features I love in Visual Studio 2015 – part 1 editor features

I spend the better part of my work day and a fair bit of my free time in Visual Studio so lately I have been thinking about which ones of the new features boost my productivity the most, so I can spend more time drinking coffee and planning my vacations. 

 

Caveat: some of these are hidden gems from 2013

In this article (part 1) I will list my top 5 new editor features (in no particular order), and in the following ones I’ll list my favorite IDE features and debugging features in VS 2015.

Improved Code Lenses

I love code lenses almost as much as I love intellisense.  If you’ve never heard of it before, I am talking about the line that appears above your code telling you things like; who is referencing this piece of code, do my tests for this method fail or pass, who changed this code, what work items did they check in against etc. etc.  Basically anything and everything you want to know about your code, right there in the context of the editor.  It’s a little bit like magic.

image

And if you want to drill deeper, you simply click on the code lens and you can move directly to the method that referenced this class/method etc.

or if you want to know what work items (in this case using Git) that this code was checked in against

image

Code lenses have actually been around since VS 2013 but only in the Ultimate edition, now it is available in both Professional and Enterprise and the number of available code lenses keeps growing.  Read more about code lenses here.

Roslyn – or Live code analysis – or Light bulb tips

The new lightning fast Roslyn compiler for C# and VB enables some really cool scenarios like live code analysis.  This means that while you type, your code is analyzed and Roslyn comes with these neat light bulb tips suggesting ways to optimize or clean up your code.

image

You can, if you are so inclined, also write your own special analyzers and code diagnostics to force the people on your team to always start class names with the letter c or whatever floats your boat.

Peek Definition (Alt+F12) – now also in XAML

One of the big productivity features in VS 2013 was to get more done without having to switch context.  Like in this case, where I want to know how FromModel is implemented.  I could press F12 and move to the implementation, which would open up the file where it was implemented and switch to that. 

Instead here I press Alt+F12 and the FromModel implementation shows up in a peek window, and I can review and edit the code without making the file context switch.

image

The peek concept has grown in VS2015 and is now used in the break point IDE for example.  But it has also expanded to XAML which gives some major productivity boosts when styling XAML since you can change the style and see the effects of the change in the designer at the same time.  

image

When you call a method defined in an interface, like GetCurrentWeatherAsync below, you can’t use “Go To Definition” or “Peek Definition” since it’ll take you to the definition in the interface (IWeatherDataAsync) rather than the implementation.

image

This is where Navigate To (Crtl+,) comes in handy, it allows you to really quickly navigate between the definitions and implementations of the method.

image

For more shortcuts, check out the VS Tips and Tricks

Intellisense for a lot more scenarios

There is now intellisense for XAML data binding

image

json (for bower.json and package.json)

image

bootstrap css classes

image

and AngularJS directives and attributes and more…

You can read more about the HTML/ASP.NET tooling improvements here

If you feel like this list is bogus because I completely missed the best feature ever, feel free to rant about it in the comments, we are all here to learn new tips and tricks Smile 

Tess

Comments

  • Anonymous
    October 25, 2015
    Great to see you back blogging Tess.  Always enjoy your posts. :)

  • Anonymous
    October 25, 2015
    Thank you Jeff:)

  • Anonymous
    October 25, 2015
    I had do to a double-take with my RSS feed this morning.  What a pleasant surprise!

  • Anonymous
    October 26, 2015
    What a surprise, Tess is back! Many thanks for your posts

  • Anonymous
    October 26, 2015
    thank you much:) it's great to see you here again too:)

  • Anonymous
    October 26, 2015
    From my experience I become very productive in VS only after installing ReSharper, it expands functionality of almost every feature you have presented - unfortunately it isn't free. IMHO code lenses sometimes are more distraction that value, I tried to use it for two months then I disabled it, but still they are people that love it. Thanks for your post.

  • Anonymous
    October 27, 2015
    Thanks for the post. Unfortunately you don't have Code Lenses in VS Professional Edition. Everything else is provided by Resharper and Web Essentials since VS 2010.

  • Anonymous
    October 28, 2015
    Great post Tess... I hope se one feature about plugins :)