Options, Text Editor, Basic (Visual Basic), Advanced

Applies to: yesVisual Studio noVisual Studio for Mac noVisual Studio Code

The VB Specific property page, in the Visual Basic folder of the Text Editor folder of the Options (Tools menu) dialog box, includes the following properties:

Applies to: yesVisual Studio noVisual Studio for Mac noVisual Studio Code

The VB Specific property page, in the Basic folder of the Text Editor folder of the Options (Tools menu) dialog box, includes the following properties:

Analysis

  • Run background code analysis for ...

    Choose one of the following options.

    Option Description
    None All analyzers and corresponding code fixes are disabled.

    Compiler diagnostics and corresponding code fixes are enabled on all open documents.
    Current document (default) All analyzers run just on the currently active document.

    Compiler diagnostics are enabled on all open documents.
    Open documents All analyzers and compiler diagnostics are enabled on all open documents.
    Entire solution All analyzers and compiler diagnostics are enabled on all documents in the solution, whether open or closed.

Using Directives

  • Place 'System' directives first when sorting usings

    When selected, the Remove and Sort Usings command in the right-click menu sorts the using directives and places the 'System' namespaces at the top of the list.

  • Separate using directive groups

    When selected, the Remove and Sort Usings command in the right-click menu separates using directives by inserting an empty line between groups of directives that have the same root namespace.

  • Suggest usings for types in reference assemblies

  • Suggest usings for types in NuGet packages

    When these options are selected, a Quick Action is available to install a NuGet package and add a using directive for unreferenced types.

    Quick Action to install NuGet package in Visual Studio

Highlighting

Enable highlighting of references and keywords

The text editor can highlight all instances of a symbol or all keywords in a clause such as If..Then, While...End While, or Try...Catch...Finally. You can navigate between highlighted references or keywords by pressing Ctrl + Shift + Down arrow or Ctrl + Shift + Up arrow.

Outlining

Enable outlining mode

When you open a file in the code editor, you can view the document in outlining mode. See Outlining for more information. When this option is selected, the outlining feature is activated when you open a file.

Show procedure line separators

The text editor indicates visual scope of procedures. A line is drawn in the .vb source files of your project at locations listed in the following table:

Location in .vb Source File Example of Line Location
After the close of a block declaration construct - At the end of a class, structure, module, interface, or enum
- After a property, function, or sub
- Not between the get and set clauses in a property
After a set of single line constructs - After the import statements, before a type definition in a class file
- After variables declared in a class, before any procedures
After single line declarations (non-block level declarations) - Following import statements, inherits statements, variable declarations, event declarations, delegate declarations, and DLL declare statements

Block Structure Guides

When selected, vertical lines appear in the editor that line up with structured code blocks, which lets you easily identify the individual blocks of code. For example, you would see a line between Sub and EndSub in a Sub statement.

Editor Help

Inline Parameter Name Hints When selected, inserts parameter name hints for literals, casted literals, and object instantiations prior to each argument in function calls.

Inline Parameter Name Hints for Visual Basic

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

  • Recase keywords, variables, and objects to the correct case

  • Add a missing Then to an If...Then statement

  • Add parenthesis to function calls

  • Add missing end quotes to strings

  • Reformat exponential notation

  • Reformat dates

Automatic insertion of end constructs

When you type—for example, the first line of a procedure declaration, Sub Main—and press Enter, the text editor adds a matching End Sub line. Similarly, if you add a For loop, the text editor adds a matching Next statement. When this option is selected, the code editor automatically adds the end construct.

Automatic insertion of Interface and MustOverride members

When you commit an Implements statement or an Inherits statement for a class, the text editor inserts prototypes for the members that have to be implemented or overridden, respectively.

Enable error correction suggestions

The text editor can suggest solutions to common errors and allow you to select the appropriate correction, which is then applied to your code.

See also