ReSharper 8.0 Web Help

Syntax highlighting

You can establish a custom font and color scheme, for more information, see Configuring Syntax Highlighting.

Default syntax highlighting:

Coding_Assistance__Syntax_Highlighting__VB.NET

Code highlighting

ReSharper detects errors and highlights them with red curly line or displays unresolved symbols in red. Hover the pointer over the error to see its description as a tooltip. For more information about the ways to find out why the code is highlighted, see Finding Out What is Wrong with Your Code.

ReSharper_by_Language__Visual_Basic__Code_Highlighting__Error

Since ReSharper has its own code inspections, you can specify whether to display them as errors, warnings, suggestions, hints, or not to display at all. For more information about configuring inspections, see Configuring Code Inspection Settings.

Solution-wide analysis

ReSharper does not only analyze errors in the current file, but also inspects the whole solution taking the dependencies between files into account and shows the results of analysis in the Errors in Solution window. For more information, see Solution-Wide Analysis.

ReSharper_by_Language__Visual_Basic__Errors_in_Solution

Inspect this

Inspect This is a shortcut to several analysis features. Those are rather powerful and allow you to see how values and method calls flow through you code. The list of available features depends on the current context.

ReSharper_by_Language__Visual_Basic__Inspect_This

For more information, see Call Tracking, Value Tracking and Viewing Type Hierarchy.

Code completion

Code Completion features help you write code faster by providing a set of items to complete based on surrounding context. For more information, see Code Completion.

Three Code Completion features are available in Visual Basic:

  • Basic Completion

    ReSharper suggests namespaces, types, methods, fields, properties, etc.

    ReSharper_by_Language__Visual_Basic__Symbol_Completion

    Enum members are also included into basic completion list.

    ReSharper_by_Language__Visual_Basic__Symbol_Completion__enum

    If you use anonymous types, ReSharper takes their properties into account and displays them in completion list along with other available items.

    ReSharper_by_Language__Visual_Basic__Symbol_Completion__anonymous_type

  • Smart Completion

    ReSharper filters items in code completion list according to the type expected in current context. Look at the example below, only those items that have string type are displayed in the drop-down list.

    ReSharper_by_Language__Visual_Basic__Smart_Completion

  • Import Symbol Completion

    ReSharper provides completion items for types and extension methods that are not visible through import directives in current context.

    ReSharper_by_Language__Visual_Basic__Import_Symbol_Completion

Examples of quick-fixes

Remove redundant 'imports'
If none of the symbols from a particular namespace are used, the corresponding Imports directive is considered as redundant.

ReSharper_by_Language__Visual_Basic__Quick-Fixes__remove_redundant_import_01

ReSharper provides the quick-fix to remove all such directives from a file.

ReSharper_by_Language__Visual_Basic__Quick-Fixes__remove_redundant_import_02

Import type
If you use a symbol from a namespace that is not imported, ReSharper suggests to import the corresponding namespace and provides the necessary quick-fix.

ReSharper_by_Language__Visual_Basic__Quick-Fixes__import_type_01

Add 'Async' modifier
Asynchronous operations have some advantages over synchronous programming, so ReSharper keeps pace with times and new language features for asynchronous programming are thoroughly supported.

ReSharper_by_Language__Visual_Basic__Quick-Fixes__make_async_01

The GetQuotesAsync function contains the await operator, but the function isn't defined as asynchronous. ReSharper detects such mismatch and prompts to improve the code using the Add 'Async' modifier quick-fix. After applying the quick-fix, the missing modifier is added to the function declaration.

Change type
If the type of the method argument doesn't match the type of the corresponding method parameter, ReSharper suggests to change the type of argument and provides the necessary quick-fix.

ReSharper_by_Language__Visual_Basic__Quick-Fixes__change_type_01

Initialize auto-property from constructor parameter
If you have a constructor parameter and you want to initialize an existing auto-property with parameter's value, use this quick-fix.

ReSharper_by_Language__Visual_Basic__Quick-Fixes__initialize_auto-property_01

ReSharper_by_Language__Visual_Basic__Quick-Fixes__initialize_auto-property_02

Create method from usage
If there is a call of a method that does not exist yet, ReSharper provides the necessary quick-fix to create such method.

ReSharper_by_Language__Visual_Basic__Quick-Fixes__create_method_01

ReSharper_by_Language__Visual_Basic__Quick-Fixes__create_method_02

Examples of context actions

Add new format item
If you need to add some dynamic data to a string literal, use this context action.

ReSharper_by_Language__Visual_Basic__Quick-Fixes__add_new_format_item_01

It wraps the string literal with the String.Format method call, adds a placeholder at the current caret position and lets you specify the corresponding parameter.

Change member visibility
If you need to adjust member visibility, ReSharper provides a context action that allows to do this quickly.

ReSharper_by_Language__Visual_Basic__Context_Actions__change_visibility_01

ReSharper_by_Language__Visual_Basic__Context_Actions__change_visibility_02

Convert Function to Sub
In case you want to convert a Visual Basic .NET Function to a Sub, there's the corresponding context action as well.

ReSharper_by_Language__Visual_Basic__Context_Actions__convert_function_to_sub_01

Convert to property with backing field
You can easily transform an automatic property to a property with backing field. Place the caret at the name of an automatic property and press Alt+Enter. ReSharper suggests you the appropriate context action.

ReSharper_by_Language__Visual_Basic__Context_Actions__automatic_property_01

Create overload without parameter
For each parameter of a function there's a context action that will create a function without that parameter which calls the original function.

ReSharper_by_Language__Visual_Basic__Context_Actions__create_overload_01

ReSharper_by_Language__Visual_Basic__Context_Actions__create_overload_02

Implement member
After you add a new member to a base class, the next logical step is to implement this member in all classes derived from the base class. You can write code manually, but a better decision is to apply the appropriate context action.

ReSharper_by_Language__Visual_Basic__Context_Actions__implement_member_01

ReSharper automatically detects all derived classes and prompts you to decide where a base class member should be implemented and generates code.

ReSharper_by_Language__Visual_Basic__Context_Actions__implement_member_02

Rearrange code

Moving Code Elements is available in Visual Basic as well. For example, you can move a member declaration up or down within a type.

ReSharper_by_Language__Visual_Basic__Moving_Code_Elements_01

You can move a statement out of or into a block of code. For example, to move If statement out of For Each loop, press Ctrl+Shift+Alt+LeftCtrl+Shift+Alt+Left.

ReSharper_by_Language__Visual_Basic__Moving_Code_Elements_02

You can reorder parameters of a method call or a method declaration. For example, to move FileId argument to the right, press Ctrl+Shift+Alt+RightCtrl+Shift+Alt+Right.

ReSharper_by_Language__Visual_Basic__Moving_Code_Elements_03