New handy Visual Studio extensions
I’m a huge fan of Visual Studio extensions – both consuming and creating them. Whenever I come across a missing feature in Visual Studio, my first instinct is to search for an extension that provides it. If it doesn’t exist, I create it.
In the past couple of months, I’ve created 3 tiny extensions that each adds features I’ve been missing. Each of these are highly specialized and solves a single problem each.
Trailing Whitespace Visualizer
I like my code files clean and without unneeded trailing whitespace. Format Document (ctrl+k, ctrl+d) takes care of removing the trailing whitespace, but I’d like to see it clearly in the editor while coding. Here’s what it looks like:
The color can be customized in case you don’t like red.
Download Trailing Whitespace Visualizer on the VS Gallery
Error Watcher
I don’t normally have the Error List visible in Visual Studio, so I often save files containing errors, just to find out that my project won’t build or work at runtime. That’s annoying. I wanted a more visual way to be informed about errors without looking at the details in the Error List. My solution was to show the number of errors on the file containing them at the top of the editor window.
When no errors exist in the file, nothing will be shown in the editor. If you save the document with errors, a small red line will flash briefly to make you aware of it.
Download Error Watcher on the VS Gallery
Add empty file
Often times I just want to add an empty file to my project. It could be a .json or .js file for instance. In cases like that, I find that going into the Add New Item dialog takes to long and I sometimes have to search for the file type I want. It would be easier if I could just enter the file name with the extension I want and have it created for me. Also, the Add New Item dialog doesn’t allow me to create file names starting with a dot like in .gitignore.
I added a button to the Add flyout context menu:
This will prompt me for a file name:
Here I can type whatever file name I want and it will be created, added to my project and opened in the editor.
Download Add Empty File on the VS Gallery
Remember, unlike some browsers, Visual Studio doesn’t slow down when using multiple extensions. Most of them only load in specific circumstances and doesn’t do anything when not used. That’s true for these three extensions too.
All three extensions are of course open source on GitHub.
Comments
Thanks Mads for all of your work and making it available on GitHub for all to learn from. You work is appreciated!
Kerry Jenkinstrailing whitespaces: maybe just show all whitespaces, but decrease color's saturation...
abcOff topic question: Anyway we can get an extension which will let us use a different search provider in VS? Really sorry, but Search in VS totally blows chunks... I'm use to using Actual Search and Replace: http://www.divlocsoft.com/ and no, I don't work for them nor do I have a financial interest in this company. never liked 99% of MS search products and told Guthrie in 2001 that Site Server Search blows chunks, and that you had better watch out because somebody is going to take over that space (-> Google) Thanks Rob
Rob Karatzas@Rob, Not that I know of. It wouldn't be difficult to create an extension that takes over CTRL F and launches a WinForms/WPF app or another .exe instead.
Mads KristensenAnother one (while working with Visual Studio 2013 Ult.) today. Is there anyway to elevate privileges in VS after the fact? VS tells me .config is "mucked up", double-click on the .config, make changes (my bad), and try to save you get (idiotic messages like): Access Denied (WTF, I've already looked at and edited the file) At least try to do something sensible (versus absolute babble). Respectfully Rob
Rob KaratzasThank you so much for your information and sheer love for ASP.Net
Tony Winston@Mads and @Rob. How about the Sando full text search extension for VS? I haven't tried it yet but here's a link to it on Channel 9: http://channel9.msdn.com/coding4fun/blog/Say-no-to-grep-say-hello-to-real-code-searching-with-Sando-Code-Search-Extension
Robert OschlerCan I suggest a new extension that could be very useful? Duplicate file (or item) -> Creates a new file with the same content and prompt to edit the file name. I always start a new file using one that's pretty similar and then replace and made changes to it.
Eduardo@Tony don't get me wrong, I do love this product. I was an ASP Ace before there was C# (think it was called "cool") and there was an ASP.NET. Was using it before it was ever released :) (Gave a lot of feedback to the ASP.NET team over 2 years 2000-2001 :)
Rob Karatzas@Robert Thank you, I'll take a look :)
Rob Karatzas@Rob Try Productivity Power Tools Extension. The search box it's very useful.
EricI beg of you Mads, if you have any influence with VS, can we get a permanent setting on this: "You have mixed tabs and spaces. Fix this?" I'd just like to set it as a standard for my developer group. I appreciate it that it tells me this, but not 200 times a day. (So set it ONCE in options, by language, if it see's a default white space setting, don't keep popping up, just do what I'm telling you in settings. :) Thanks Rob
Rob KaratzasOne thing that would make Add empty file perfect, would be if there was a checkbox for not adding the file to the project. I like Visual Studio editor but now I "need" to use a separate editor for temp files. So please add a way of creating an empty file that's not added to the project! Thanks!
Anders Eriksson@Anders, that's a great idea. Thanks
Mads Kristensen@Rob, have you taken a look at http://editorconfig.org/ ? It should fix it for you
Mads Kristensen@Mads will take a look at this over the weekend (and will see how this can be applied to various C# applications we develop in VS). Haven't looked at Visual Studio Online, but will need to check this out as well. thanks!
Rob KaratzasComments are closed