2008-08-13 36 views

Trả lời

5

Kiểm tra Resharper - đó là một tiện ích bổ sung Visual Studio với tính năng này, trong số nhiều phát triển khác có ích.

Đồng thời xem C# Completer, một tiện ích bổ sung khác.

Nếu bạn muốn cuộn của riêng mình, hãy kiểm tra this article. Tuy nhiên, người ta phải làm điều đó.

2

Nó có thể đạt được bằng cách sử dụng đoạn mã, một số đã được xây dựng trong (thử gõ "svm" và nhấn TAB-TAB) ..

Có một sự giàu có của thông tin trên mạng về việc tạo ra những:

Jeff did a post himself here

Có google! Tôi sử dụng chúng LOTS! : D

6

Các công cụ tìm kiếm tốt đẹp (! Đặc biệt là Resharper nhưng tại $ 200-350 ouch) nhưng tôi đã kết thúc chỉ ghi một macro và gán nó vào Ctrl + Alt + [

Macro xuất hiện như thế này:

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 

Chỉnh sửa: Tôi đã sử dụng máy ghi macro để thực hiện việc này và không quá tệ

0

Tôi vừa tạo một bản ghi dựa trên @ Luke ở trên. Cái này, bạn muốn nhấn Enter rồi nhấn tổ hợp phím của bạn và nó sẽ chèn:

if() 
{ 

} 
else 
{ 

} 

Và nó sẽ đặt con trỏ vào dấu ngoặc đơn bằng câu lệnh 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 
Các vấn đề liên quan