开发者

VS2008 Hot Key for Specific Code Formatting

开发者 https://www.devze.com 2023-03-22 13:05 出处:网络
All, In my VS2008 C# editor window I\'m trying to get from this: /******** CONSTANTS ********/ const int HOLD_AWAITING_PAYMENT = 1;

All, In my VS2008 C# editor window I'm trying to get from this:

/******** CONSTANTS ********/
const int HOLD_AWAITING_PAYMENT = 1;
const int HOLD_INT_LENDER_APPROVAL = 2;
const int HOLD_MDIA = 3;

to this:

/******** CONSTANTS ********/
const int HOLD_AWAITING_PAYMENT      = 1;
const int HOLD_INT_LENDER_APPROVAL   = 2;
const int HOLD_MDIA                  = 3;

I seem to remember that there's a hot key or plug-in or somethat that does this. Does any开发者_开发知识库one remember the formatting trick?


There is a macro called LineEmUp in VS 2008 that does exactly this.
Tools > Options > Keyboard > Show commands containing: LineEmUp

You can assign it to any key combination right there.

Upd: note that you have to call it multiple times if you need to format more than one "column" in your code block.


[CTRL] + [K] + [CTRL] + [D] is the default hotkey sequence to format an entire document.

However the rules regarding the formatting of the code is dependent on the settings configured in:

Tools > Options > Text Editor > {Language} > Formatting


Not with the default formatting of VS. You're looking for what's called 'alignment' setting in other editors. You need to use a extension like Resharper (there are others but I can't recollect now).

0

精彩评论

暂无评论...
验证码 换一张
取 消