Partager via


ITextStructureNavigatorSelectorService.GetTextStructureNavigator Method

Definition

Gets a ITextStructureNavigator for the specified ITextBuffer, either by creating a new one or by using a cached value.

public:
 Microsoft::VisualStudio::Text::Operations::ITextStructureNavigator ^ GetTextStructureNavigator(Microsoft::VisualStudio::Text::ITextBuffer ^ textBuffer);
public:
 Microsoft::VisualStudio::Text::Operations::ITextStructureNavigator ^ GetTextStructureNavigator(Microsoft::VisualStudio::Text::ITextBuffer ^ textBuffer);
Microsoft::VisualStudio::Text::Operations::ITextStructureNavigator GetTextStructureNavigator(Microsoft::VisualStudio::Text::ITextBuffer const & textBuffer);
public Microsoft.VisualStudio.Text.Operations.ITextStructureNavigator GetTextStructureNavigator (Microsoft.VisualStudio.Text.ITextBuffer textBuffer);
abstract member GetTextStructureNavigator : Microsoft.VisualStudio.Text.ITextBuffer -> Microsoft.VisualStudio.Text.Operations.ITextStructureNavigator
Public Function GetTextStructureNavigator (textBuffer As ITextBuffer) As ITextStructureNavigator

Parameters

textBuffer
ITextBuffer

The ITextBuffer that the ITextStructureNavigator will navigate.

Returns

A valid ITextStructureNavigator. This value will never be null.

Exceptions

textBuffer is null.

Remarks

If a navigator for the exact IContentType of the given ITextBuffer cannot be found, this method returns one for the parent IContentType. If there is more than one parent IContentType for which there is a matching ITextStructureNavigator, then this method returns the ITextStructureNavigator of an arbitrary parent.

If a new navigator is created, it is cached together with textBuffer, and its lifetime is the same as that of textBuffer.

Applies to