简体   繁体   English

是否可以覆盖VB.NET/VS2008中注释的自动缩进?

[英]Is it possible to override the auto-indentation of comments in VB.NET/VS2008?

Is it possible to override the auto-indentation of comments in VB.NET (Using visual studio 2008)? 是否可以在VB.NET中覆盖注释的自动缩进(使用Visual Studio 2008)?

Please see the comment above the second Case Statement in the code below for context. 有关上下文,请参见下面代码中第二个Case Statement上方的注释。

The IDE auto-indents the comment beyond the following Case Statement. IDE会自动缩进注释,而不是下面的案例声明。 I would like to override this behavior and bring it in line with the C in Case that follows. 我想重写此行为,并使其与随后的Case中的C一致。

Select Case E.Type

    'General Events
    Case EventType.General_StartServer
        'Initialize the Server Brain (ME)
        GLOBAL__I_AM_THE_SERVER = True
        Init()

        'Server Alerts
    Case EventType.ServerAlert_Chat
        EventManager.SendEventToAllClients(New GameEvent(EventType.ClientAlert_Chat, 0, 0, 0, E.Str))

End Select

While you can completely turn off the reformatting, I bet that isn't the solution you had in mind. 虽然您可以完全关闭重新格式化,但我敢打赌,这不是您想到的解决方案。

Personally, in the given code, I put my comments pertaining to the case underneath it. 就个人而言,在给定的代码中,我将与案例有关的评论放在其下方。

Select Case E.Type
    Case EventType.General_StartServer
        ' The server has started, so we need to do blah.

    Case EventType.ServerAlert_Chat
        ' A chat has sent a server alert, so do blah.
End Select

I think you're looking for this in the menu: 我认为您正在菜单中寻找这个:

Tools->Options->Text Editor->Basic->VB Specific->Pretty listing (reformatting) of code 工具->选项->文本编辑器->基本-> VB特定->代码的漂亮列表(重新格式化)

From MSDN : MSDN

Pretty Listing (reformatting) of code 漂亮的代码清单(重新格式化)

The text editor reformats your code as appropriate. 文本编辑器将适当地重新格式化您的代码。 When this option is selected, the code editor will: 选择此选项后,代码编辑器将:

  • Align your code to the correct tab position 将代码对齐到正确的标签位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM