2008-08-13 108 views

回答

5

退房Resharper - 它是一个Visual Studio插件,具有此功能以及许多其他开发帮助。请参阅C# Completer,另一个附加组件。

如果您想自己推出,请查看this article。疯狂的人应该必须这样做,但。

2

它可以通过使用代码段来实现,一些已经建成(尝试键入“SVM”击中TAB-TAB)..

有创造这些是一个丰富的信息对网:

Jeff did a post himself here

有一个谷歌!我用它们很棒! :D

6

这些工具看起来不错(!特别是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 

编辑:我用宏记录器来做到这一点,并没有太坏

0

我刚刚创建了一个基于@卢克的上面。这一次,你要按下回车键,然后打你的组合键,它会插入:

if() 
{ 

} 
else 
{ 

} 

它将把光标放在括号由if语句。

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 
相关问题