In This Article

LLParseDataCodeBlockFinder Class

Represents a default implementation of an ICodeBlockFinder that is capable of returning containing code blocks based on AST parse data from an ILLParser.

public class LLParseDataCodeBlockFinder : ICodeBlockFinder
Inheritance:
object object
Derived:
DotNetCodeBlockFinderBase JavaScriptCodeBlockFinder PythonCodeBlockFinder XmlCodeBlockFinder
Implements:
ICodeBlockFinder

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 ICodeBlockFinder interface type, its features can be used by the language.

Constructors

LLParseDataCodeBlockFinder()

Initializes an instance of the class.

public LLParseDataCodeBlockFinder()

Properties

Filter

Gets or sets the optional callback used to determine if a potential IAstNode result is valid.

public Predicate<IAstNode> Filter { get; set; }

Property Value

Predicate<IAstNode>:

The optional callback used to determine if a potential IAstNode result is valid.

Methods

FindContaining(TextSnapshotRange)

Returns the TextSnapshotRange of the containing code block.

public virtual TextSnapshotRange FindContaining(TextSnapshotRange snapshotRange)
Parameter Type Description
snapshotRange TextSnapshotRange

The TextSnapshotRange from which to begin the search.

Returns

TextSnapshotRange:

The TextSnapshotRange of the containing code block.

GetSnapshotRange(TextSnapshotRange, IAstNode, TextSnapshotRange)

Returns a TextSnapshotRange for the specified IAstNode.

protected virtual TextSnapshotRange GetSnapshotRange(TextSnapshotRange searchSnapshotRange, IAstNode astNode, TextSnapshotRange astNodeSnapshotRange)
Parameter Type Description
searchSnapshotRange TextSnapshotRange

The TextSnapshotRange from which to begin the search.

astNode IAstNode

The IAstNode that was found to contain the search snapshot range.

astNodeSnapshotRange TextSnapshotRange

The full snapshot range of the IAstNode.

Returns

TextSnapshotRange:

A TextSnapshotRange for the specified IAstNode.

Remarks

The default implementation of this method returns the astNodeSnapshotRange value. This method can optionally be used to adjust the snapshot range for an AST node as necessary.

TranslateToParseDataSnapshot(ILLParseData, TextSnapshotOffset)

Translates the specified snapshot offset to the parse data's Snapshot, if possible, prior to containing AST node lookup.

protected virtual TextSnapshotOffset TranslateToParseDataSnapshot(ILLParseData parseData, TextSnapshotOffset snapshotOffset)
Parameter Type Description
parseData ILLParseData

The ILLParseData to examine.

snapshotOffset TextSnapshotOffset

The TextSnapshotOffset to translate.

Returns

TextSnapshotOffset:

The translated offset.

Inherited Members