Tutorial :Visual Studio code formatter


I'm using Visual Studio 2008 for doing work in C# and JavaScript (AJAXy stuff).

Here's my issue -- I love Eclipse and especially the code formatted (Ctrl-Shift-F). Visual Studio's Ctrl-k, Ctrl-d, really sucks in comparison, especially for javascript.

Is there a way to get VS to behave like the IDE that I miss?


Go into Tools | Options | Text Editor and edit the language specific settings to you're liking. Ctrl-K, Ctrl-D honors these settings, so you can make the code formatter working the way you want. There are a ton of options you can change (bracket positioning, spacing, indenting, etc.).


I use the great Resharper plugin to format my C# code. Lots of settings to change to format your code to your liking. Can even make one coding standard with Resharper to be used by all your programmers.

As for key bindings, can change those in your options.


go to options > environment > keyboard, find the command Edit.FormatDocument and bind that to ctrl + shift + f

EDIT: Misread, you can configure how VS formats in options > text editor > (document type).

don't know if you can get it exactly as how eclipse does, but that's where you set your preferences.


Here is a work around for visual studio: I just rename the extension to .css, right click inside the document and select "format document" and rename it back to .js, format is pretty good.


I have not tried but Resharper has lot of formatting and coding related nice stuff. May be you can find something useful there, and you may start loving VS as well.

Note: Resharper on VS2005 was kind of sluggish.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »