Wednesday 15 April 2015

c# - Visual Studio 2012 - How to automate open close curly brace? -


In Visual Studio 2012 I created a macro to create an open curly brace, create a new line, create a new line,

The macro was connected to Ctrl + 0 so that after Ctrl + 0 I was ready to write the code.

How can I do this in Visual Studio 2012, which does not have my macro?

This is added to the magician I created prj: Install it in VS2012 and add key combination: SHIFT + ALT + 0

  Public Zero Exec (string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled) {handled = false; If (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault) {if (commandName == "CurlyBraces.Connect.CurlyBraces") {if (_applicationObject.ActiveDocument! = Null) {TextSelection objSel = (EnvDTE.TextSelection) (_ applicationObject.ActiveDocument.Selection) ; ObjSel.NewLine (); ObjSel.Insert ("{"}; ObjSel.Indent (); ObjSel.NewLine (); ObjSel.NewLine (); ObjSel.Insert ("}"); ObjSel.Indent (); ObjSel.LineUp (); ObjSel.Indent (); ObjSel.SmartFormat (); ObjSel.LineUp (); }}}}    

No comments:

Post a Comment