我可以发誓我看到有人打字功能的标题,然后击中的一些关键的组合自动创造的功能括号,并插入标之间他们就像这样:

void foo()_

void foo()
{
    _
}

这是一个建立在功能?

有帮助吗?

解决方案

检查了 Resharper -这是一个Visual Studio加上这个要素,其中包括许多其他发展有帮助。

也见 C#完, 另一添加。

如果你想滚你自己,检查了 这篇文章.疯狂的一个应该有做到这一点,虽然。

其他提示

该工具的好看(尤其是Resharper但美元为200-350哎哟!) 但最后我只记录宏并将其分配给ctrl+alt+[

宏出来像这样:

Sub FunctionBraces()
    DTE.ActiveDocument.Selection.NewLine
    DTE.ActiveDocument.Selection.Text = "{}"
    DTE.ActiveDocument.Selection.CharLeft
    DTE.ActiveDocument.Selection.NewLine(2)
    DTE.ActiveDocument.Selection.LineUp
    DTE.ActiveDocument.Selection.Indent
End Sub

编辑:我使用的宏录音机来做这个并不是太糟糕了

它可以通过使用代码段,有些已经建立在(尝试打字"svm"和打卡片)..

有一个丰富的信息,在网上建立这些:

杰夫有没有后自己在这里

有一个谷歌!我使用它们很多!D

看看 视觉协助 为好。

我刚创建一个基于@卢克的上述。这一个,你想打进入然后打你的关键组合和将插入:

if ()
{

}
else
{

}

它将会把你的光标放在括号通过的,如果声明。

Sub IfStatement()
    DTE.ActiveDocument.Selection.Text = "if ()"
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "{"
    DTE.ActiveDocument.Selection.NewLine(2)
    DTE.ActiveDocument.Selection.Text = "}"
    DTE.ActiveDocument.Selection.NewLine()
    DTE.ActiveDocument.Selection.Text = "else"
    DTE.ActiveDocument.Selection.NewLine(2)
    DTE.ActiveDocument.Selection.Text = "{"
    DTE.ActiveDocument.Selection.NewLine(2)
    DTE.ActiveDocument.Selection.Text = "}"
    DTE.ActiveDocument.Selection.LineUp(False, 7)
    DTE.ActiveDocument.Selection.EndOfLine()
    DTE.ActiveDocument.Selection.CharLeft(3)
End Sub
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top