In This Article

PythonContextFactory Class

Creates Python language IPythonContext objects for a TextSnapshotOffset.

public class PythonContextFactory
Inheritance:
object object

Constructors

PythonContextFactory()

Initializes an instance of the class.

public PythonContextFactory()

Methods

CreateContext(TextSnapshotOffset)

Creates an IPythonContext for the specified TextSnapshotOffset.

public IPythonContext CreateContext(TextSnapshotOffset snapshotOffset)
Parameter Type Description
snapshotOffset TextSnapshotOffset

The TextSnapshotOffset for which to create a context.

Returns

IPythonContext:

The IPythonContext that was created.

CreateContext(TextSnapshotOffset, PythonContextKind)

Creates an IPythonContext for the specified TextSnapshotOffset.

public IPythonContext CreateContext(TextSnapshotOffset snapshotOffset, PythonContextKind kind)
Parameter Type Description
snapshotOffset TextSnapshotOffset

The TextSnapshotOffset for which to create a context.

kind PythonContextKind

A PythonContextKind indicating the kind of context.

Returns

IPythonContext:

The IPythonContext that was created.

FindIntersectingChildNode(IAstNode, int)

Searches through the child nodes for a node that intersects the specified offset.

public static IAstNode FindIntersectingChildNode(IAstNode node, int offset)
Parameter Type Description
node IAstNode

The IAstNode to examine.

offset int

The offset to check.

Returns

IAstNode:

The child IAstNode that intersects with the specified offset, if any.

FindIntersectingDescendantNode(IAstNode, int)

Recursively searches through the descendant nodes for a node that intersects with the specified offset.

public static IAstNode FindIntersectingDescendantNode(IAstNode node, int offset)
Parameter Type Description
node IAstNode

The IAstNode to examine.

offset int

The offset to check.

Returns

IAstNode:

The descendant IAstNode that intersects with the specified offset, if any.

TranslateToParseDataSnapshot(IPythonParseData, TextSnapshotOffset)

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

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

The IPythonParseData to examine.

snapshotOffset TextSnapshotOffset

The TextSnapshotOffset to translate.

Returns

TextSnapshotOffset:

The translated offset.

Inherited Members