In This Article

DelimiterAutoCompleter Class

Provides a default implementation for an IDelimiterAutoCompleter that can perform delimiter auto-completion.

public class DelimiterAutoCompleter : IDelimiterAutoCompleter, IEditorDocumentTextChangeEventSink, IEditorViewSelectionChangeEventSink, IEditorViewTextInputEventSink
Inheritance:
object object
Derived:
CSharpDelimiterAutoCompleter VBDelimiterAutoCompleter
Implements:
IDelimiterAutoCompleter IEditorDocumentTextChangeEventSink IEditorViewSelectionChangeEventSink IEditorViewTextInputEventSink

Remarks

Instances of this object can be registered with an ISyntaxLanguage using the RegisterService(object, object) method. Once an instance is registered with the language for the IDelimiterAutoCompleter interface type, its features can be used by the language.

Constructors

DelimiterAutoCompleter()

Initializes a new instance of the DelimiterAutoCompleter class.

public DelimiterAutoCompleter()

Properties

CanCompleteAngleBraces

Gets or sets whether angle braces can be completed.

public bool CanCompleteAngleBraces { get; set; }

Property Value

bool:

true if angle braces can be completed; otherwise, false. The default value is false.

CanCompleteCurlyBraces

Gets or sets whether curly braces can be completed.

public bool CanCompleteCurlyBraces { get; set; }

Property Value

bool:

true if curly braces can be completed; otherwise, false. The default value is true.

CanCompleteDoubleQuotes

Gets or sets whether double quotes can be completed.

public bool CanCompleteDoubleQuotes { get; set; }

Property Value

bool:

true if double quotes can be completed; otherwise, false. The default value is true.

CanCompleteParentheses

Gets or sets whether parentheses can be completed.

public bool CanCompleteParentheses { get; set; }

Property Value

bool:

true if parentheses can be completed; otherwise, false. The default value is true.

CanCompleteSingleQuotes

Gets or sets whether single quotes can be completed.

public bool CanCompleteSingleQuotes { get; set; }

Property Value

bool:

true if single quotes can be completed; otherwise, false. The default value is false.

CanCompleteSquareBraces

Gets or sets whether square braces can be completed.

public bool CanCompleteSquareBraces { get; set; }

Property Value

bool:

true if square braces can be completed; otherwise, false. The default value is true.

OpenAngleBraceTokenId

Gets the optional token ID value used to ensure that an open angle brace character is valid for auto-completion.

public int? OpenAngleBraceTokenId { get; set; }

Property Value

int?:

The optional token ID value used to ensure that an open angle brace character is valid for auto-completion.

Remarks

Leave the value null if token validation is not required for angle braces.

OpenCurlyBraceTokenId

Gets the optional token ID value used to ensure that an open curly brace character is valid for auto-completion.

public int? OpenCurlyBraceTokenId { get; set; }

Property Value

int?:

The optional token ID value used to ensure that an open curly brace character is valid for auto-completion.

Remarks

Leave the value null if token validation is not required for curly braces.

OpenDoubleQuoteTokenId

Gets the optional token ID value used to ensure that an open double quote character is valid for auto-completion.

public int? OpenDoubleQuoteTokenId { get; set; }

Property Value

int?:

The optional token ID value used to ensure that an open double quote character is valid for auto-completion.

Remarks

Leave the value null if token validation is not required for double quotes.

OpenParenthesisTokenId

Gets the optional token ID value used to ensure that an open parenthesis character is valid for auto-completion.

public int? OpenParenthesisTokenId { get; set; }

Property Value

int?:

The optional token ID value used to ensure that an open parenthesis character is valid for auto-completion.

Remarks

Leave the value null if token validation is not required for parentheses.

OpenSingleQuoteTokenId

Gets the optional token ID value used to ensure that an open single quote character is valid for auto-completion.

public int? OpenSingleQuoteTokenId { get; set; }

Property Value

int?:

The optional token ID value used to ensure that an open single quote character is valid for auto-completion.

Remarks

Leave the value null if token validation is not required for single quotes.

OpenSquareBraceTokenId

Gets the optional token ID value used to ensure that an open square brace character is valid for auto-completion.

public int? OpenSquareBraceTokenId { get; set; }

Property Value

int?:

The optional token ID value used to ensure that an open square brace character is valid for auto-completion.

Remarks

Leave the value null if token validation is not required for square braces.

Methods

IsValidForEndDelimiterAutoComplete(TextSnapshotOffset, char)

Returns whether an end delimiter is valid to be auto-inserted at the specified TextSnapshotOffset.

protected virtual bool IsValidForEndDelimiterAutoComplete(TextSnapshotOffset snapshotOffset, char endDelimiter)
Parameter Type Description
snapshotOffset TextSnapshotOffset

The TextSnapshotOffset at which to possibly auto-insert the delimiter.

endDelimiter char

The end delimiter.

Returns

bool:

true if the end delimiter is valid to be auto-inserted at the specified TextSnapshotOffset; otherwise, false.

IsValidStartDelimiter(ITextSnapshotReader, char)

Returns whether an ITextSnapshotReader's current offset is immediately after the specified start delimiter.

protected virtual bool IsValidStartDelimiter(ITextSnapshotReader reader, char startDelimiter)
Parameter Type Description
reader ITextSnapshotReader

The ITextSnapshotReader to examine.

startDelimiter char

The start delimiter.

Returns

bool:

true if the ITextSnapshotReader's current offset is immediately after the specified start delimiter; otherwise, false.

IsValidStartDelimiter(IToken, char)

Returns whether an IToken represents the specified start delimiter.

protected virtual bool IsValidStartDelimiter(IToken token, char startDelimiter)
Parameter Type Description
token IToken

The IToken to examine.

startDelimiter char

The start delimiter.

Returns

bool:

true if the IToken represents the specified start delimiter; otherwise, false.

Remarks

The default implementation of this method compares the token ID to the IDs specified in the OpenAngleBraceTokenId, OpenCurlyBraceTokenId, OpenParenthesisTokenId, and OpenSquareBraceTokenId properties. This method is called by the default implementation of the IsValidForEndDelimiterAutoComplete(TextSnapshotOffset, char) method.

OnDocumentTextChanged(SyntaxEditor, EditorSnapshotChangedEventArgs)

Occurs after a text change occurs to an IEditorDocument that uses this language.

protected virtual void OnDocumentTextChanged(SyntaxEditor editor, EditorSnapshotChangedEventArgs e)
Parameter Type Description
editor SyntaxEditor

The SyntaxEditor whose IEditorDocument is changed.

e EditorSnapshotChangedEventArgs

The EditorSnapshotChangedEventArgs that contains the event data.

OnDocumentTextChanging(SyntaxEditor, EditorSnapshotChangingEventArgs)

Occurs before a text change occurs to an IEditorDocument that uses this language.

protected virtual void OnDocumentTextChanging(SyntaxEditor editor, EditorSnapshotChangingEventArgs e)
Parameter Type Description
editor SyntaxEditor

The SyntaxEditor whose IEditorDocument is changed.

e EditorSnapshotChangingEventArgs

The EditorSnapshotChangingEventArgs that contains the event data.

OnViewSelectionChanged(IEditorView, EditorViewSelectionEventArgs)

Occurs when the selection is changed in the specified IEditorView.

protected virtual void OnViewSelectionChanged(IEditorView view, EditorViewSelectionEventArgs e)
Parameter Type Description
view IEditorView

The IEditorView that received the event.

e EditorViewSelectionEventArgs

The EditorViewSelectionEventArgs that contains the event data.

OnViewTextInput(IEditorView, TextCompositionEventArgs)

Occurs before text is input to the specified IEditorView.

protected virtual void OnViewTextInput(IEditorView view, TextCompositionEventArgs e)
Parameter Type Description
view IEditorView

The IEditorView that received the event.

e TextCompositionEventArgs

The TextCompositionEventArgs that contains the event data.

Inherited Members