ITextStructureNavigator Interface
Provides methods to navigate text, such as getting word extents.
Namespace: Microsoft.VisualStudio.Text.Operations
Assembly: Microsoft.VisualStudio.Text.Logic (in Microsoft.VisualStudio.Text.Logic.dll)
Syntax
'宣言
Public Interface ITextStructureNavigator
public interface ITextStructureNavigator
public interface class ITextStructureNavigator
type ITextStructureNavigator = interface end
public interface ITextStructureNavigator
The ITextStructureNavigator type exposes the following members.
Properties
Name | Description | |
---|---|---|
ContentType | Gets the content type that this navigator supports. |
Top
Methods
Name | Description | |
---|---|---|
GetExtentOfWord | Gets the extent of the word at the given position. | |
GetSpanOfEnclosing | Gets the span of the enclosing syntactic element of the specified snapshot span. | |
GetSpanOfFirstChild | Gets the span of the first child syntactic element of the specified snapshot span. | |
GetSpanOfNextSibling | Gets the span of the next sibling syntactic element of the specified snapshot span. | |
GetSpanOfPreviousSibling | Gets the span of the previous sibling syntactic element of the specified snapshot span. |
Top
Remarks
Implement this interface if you need to provide a special definition of a word extent in your language or content type, or if you need to define a special relationship between sibling or parent/child syntactic elements. To use it in your extension, you must also implement (in a separate class) the ITextStructureNavigatorProvider so that it creates a navigator of your type, and export this class for your content type. In this case the ITextStructureNavigatorSelectorService will assign your navigator to buffers that have the correct content type.
Examples
For an example of how to use the navigator and the navigator provider to get word extents, see Walkthrough: Displaying SmartTags.