An indent provider enables support for smart indent features when pressing Enter.
The Indent Providers topic talks about indent providers in general and how to register them as a "feature" language service.
The VBIndent
Feature Summary
Smart Indent
The built-in indent provider will attempt to properly indent lines inside the current block scope. For instance, pressing Enter after a Sub
signature will cause the next line to be indented by one tab stop.
Typed Characters
When a space is typed after certain keywords such as End
, Next
, etc., the line will be examined to see if it should be outdented.
Registering with a Syntax Language
Any object that implements IIndent
The VBSyntax
This code creates a custom indent provider (defined in a make-believe CustomVBIndentProvider
class) and registers it with the syntax language that is already declared in the language
variable:
Note
The SyntaxActiproSoftware.Text
namespace is imported. See the Service Locator Architecture topic for details on registering and retrieving various service object instances, both via extension methods and generically, as there are some additional requirements for using the extension methods.
Disabling the Functionality
Since this feature is installed as a "feature" service on the language and is installed on VBSyntax