TokenTagger Class
An ITagger<T> implementation that provides ITokenTag and IClassificationTag objects based on a language's ILexer.
public class TokenTagger : TaggerBase<ITokenTag>, ITagger<ITokenTag>, ITagger<IClassificationTag>, ITaggerBase, IOrderable, IKeyedObject
- Inheritance:
- object TaggerBase<ITokenTag> object
- Implements:
- ITagger<ITokenTag> ITagger<IClassificationTag> ITaggerBase IOrderable IKeyedObject
Constructors
TokenTagger(ICodeDocument)
An ITagger<T> implementation that provides ITokenTag and IClassificationTag objects based on a language's ILexer.
public TokenTagger(ICodeDocument document)
| Parameter | Type | Description |
|---|---|---|
| document | ICodeDocument | The document to which this manager is attached. |
Methods
ClassifyToken(IToken)
Returns an IClassificationType for the specified IToken, if one is appropriate.
public virtual IClassificationType? ClassifyToken(IToken token)
| Parameter | Type | Description |
|---|---|---|
| token | IToken | The IToken to examine. |
Returns
Remarks
The default implementation of this method automatically returns the classification type if the token is an IMergeableToken.
GetTags(NormalizedTextSnapshotRangeCollection, object?)
Returns the tag ranges that intersect with the specified normalized snapshot ranges.
public override IEnumerable<TagSnapshotRange<ITokenTag>> GetTags(NormalizedTextSnapshotRangeCollection snapshotRanges, object? parameter)
| Parameter | Type | Description |
|---|---|---|
| snapshotRanges | NormalizedTextSnapshotRangeCollection | The collection of normalized snapshot ranges. |
| parameter | object | An optional parameter that provides contextual information about the tag request. |
Returns
GetTokens(ILexer, TextSnapshotRange, object?, bool, out int)
Returns the ITokenSet containing the tokens that were parsed for the specified TextSnapshotRange.
protected ITokenSet? GetTokens(ILexer lexer, TextSnapshotRange desiredSnapshotRange, object? parseContext, bool canUpdateLineContexts, out int invalidateThroughOffset)
| Parameter | Type | Description |
|---|---|---|
| lexer | ILexer | The ILexer to use for token generation. |
| desiredSnapshotRange | TextSnapshotRange | The TextSnapshotRange that should be examined. |
| parseContext | object | An optional object that may be used to help provide context information when resuming incremental parsing. |
| canUpdateLineContexts | bool | Whether line contexts can be updated. |
| invalidateThroughOffset | int | Returns the offset through which tokens were invalidated. |
Returns
OnClosed()
Occurs when the tagger is closed.
protected override void OnClosed()
RaiseTagsChanged(TagsChangedEventArgs)
Raises the TagsChanged event.
public void RaiseTagsChanged(TagsChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | TagsChangedEventArgs | The event data. |
Inherited Members
- TaggerBase<ITokenTag>.ChangeDocument(ICodeDocument)
- TaggerBase<ITokenTag>.Close()
- TaggerBase<ITokenTag>.OnTagAggregatorAttached(ITagAggregatorBase)
- TaggerBase<ITokenTag>.OnTagAggregatorDetached(ITagAggregatorBase)
- TaggerBase<ITokenTag>.OnTagsChanged(TagsChangedEventArgs)
- TaggerBase<ITokenTag>.Document
- TaggerBase<ITokenTag>.Key
- TaggerBase<ITokenTag>.Orderings
- TaggerBase<ITokenTag>.Closed
- TaggerBase<ITokenTag>.TagsChanged
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()