Is it possible to override auto-indexing of comments in VB.NET/VS2008?

Is it possible to override the automatic indentation of comments in VB.NET (using Visual Studio 2008)?

Please see the comment above the second case in the code below for context.

An IDE automatically indicates a comment beyond the following case. I would like to redefine this behavior and bring it into line with the example below.

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 
+4
source share
2 answers

While you can completely turn off reformatting, I'm sure this is not the solution you had in mind.

Personally, in this code, I put my comments related to the case under 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 
+1
source

I think you are looking for this in the menu:

Tools-> Options-> Text Editor-> General-> VB Specific-> Enumeration (reformatting) of code is enough

From MSDN :

Presentation (reformatting) of the code

A text editor will reformat your code as appropriate. When this option is selected, the code editor will:

  • Align your code with the correct tab
+1
source

All Articles