在Visual Studio 2012中,我创建了一个宏来创建一个打开的大括号,创建一个新行,创建一个新行,创建右大括号并将光标移动一行,然后是TAB。Visual Studio 2012 - 如何自动打开关闭大括号?
,宏观是后按Ctrl与按Ctrl +使相关+ 我正准备写代码。
我该怎么做在Visual Studio 2012中没有我的宏?
在Visual Studio 2012中,我创建了一个宏来创建一个打开的大括号,创建一个新行,创建一个新行,创建右大括号并将光标移动一行,然后是TAB。Visual Studio 2012 - 如何自动打开关闭大括号?
,宏观是后按Ctrl与按Ctrl +使相关+ 我正准备写代码。
我该怎么做在Visual Studio 2012中没有我的宏?
这是从MSDN的Visual Studio Gallery免费下载的。 我想你会发现这是伎俩。
http://visualstudiogallery.msdn.microsoft.com/8e2103b6-87cf-4fef-9410-a580c434b602
这是我加入向导创建PRJ:在VS2012和准组合键安装:SHIFT + ALT + 0
public void 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();
}
}
}
}
计划自己的插件。 http://msdn.microsoft.com/en-us/library/vstudio/80493a3w.aspx –
http://visualstudiogallery.msdn.microsoft.com/8e2103b6-87cf-4fef-9410-a580c434b602 –
谢谢Fabian。 我创建了一个快速和肮脏的插件。将其放入执行文件(...) 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(); – user2418209