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 Java
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 {
will cause the next line to be indented by one tab stop. Pressing Enter while still typing a statement will also attempt to indent the next line by one tab stop.
Typed Characters
When certain characters such as {
, }
, or :
are typed, the line will be examined to see if it should be indented/outdented.
Registering with a Syntax Language
Any object that implements IIndent
The Java
This code creates a custom indent provider (defined in a make-believe CustomJavaScriptIndentProvider
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 Java