TextSearcher Class
Provides core functionality for searching within an ITextSnapshot that is typically wrapped by external helper methods.
public static class TextSearcher
- Inheritance:
- object object
Methods
FindAll(ITextSnapshot, ISearchOptions, TextRange)
Performs a find all operation over a specific range of the snapshot.
public static ISearchResultSet FindAll(ITextSnapshot snapshot, ISearchOptions options, TextRange searchTextRange)
Parameter | Type | Description |
---|---|---|
snapshot | ITextSnapshot | The ITextSnapshot in which to search. |
options | ISearchOptions | The ISearchOptions to use. |
searchTextRange | TextRange | The TextRange of offsets to search.
If all should be searched, specify the range |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.
FindNext(ITextSnapshot, ISearchOptions, int, bool, TextRange)
Performs a find next operation over a specific range of the snapshot.
public static ISearchResultSet FindNext(ITextSnapshot snapshot, ISearchOptions options, int startOffset, bool canWrap, TextRange searchTextRange)
Parameter | Type | Description |
---|---|---|
snapshot | ITextSnapshot | The ITextSnapshot in which to search. |
options | ISearchOptions | The ISearchOptions to use. |
startOffset | int | The offset at which to start the search. |
canWrap | bool | Whether the search can wrap at the end of the search text range. |
searchTextRange | TextRange | The TextRange of offsets to search.
If all should be searched, specify the range |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.
FindNext(ITextSnapshot, ISearchOptions, int, bool, TextRange, CancellationToken)
Performs a find next operation over a specific range of the snapshot.
public static ISearchResultSet FindNext(ITextSnapshot snapshot, ISearchOptions options, int startOffset, bool canWrap, TextRange searchTextRange, CancellationToken cancellationToken)
Parameter | Type | Description |
---|---|---|
snapshot | ITextSnapshot | The ITextSnapshot in which to search. |
options | ISearchOptions | The ISearchOptions to use. |
startOffset | int | The offset at which to start the search. |
canWrap | bool | Whether the search can wrap at the end of the search text range. |
searchTextRange | TextRange | The TextRange of offsets to search.
If all should be searched, specify the range |
cancellationToken | CancellationToken | The cancellation token that can abort the search operation. |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.
ReplaceAll(ITextDocument, object, ISearchOptions, params TextRange[])
Performs a replace all operation over a specific range of the snapshot.
public static ISearchResultSet ReplaceAll(ITextDocument document, object source, ISearchOptions options, params TextRange[] searchTextRanges)
Parameter | Type | Description |
---|---|---|
document | ITextDocument | The ITextDocument in which to search. |
source | object | The optional source of the text change, which is most often an editor view if specified. |
options | ISearchOptions | The ISearchOptions to use. |
searchTextRanges | TextRange[] | The TextRange array of offsets to search.
If everything should be searched, specify the range |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.
ReplaceNext(ITextDocument, object, ISearchOptions, int, bool, TextRange)
Performs a replace next operation over a specific range of the snapshot.
public static ISearchResultSet ReplaceNext(ITextDocument document, object source, ISearchOptions options, int startOffset, bool canWrap, TextRange searchTextRange)
Parameter | Type | Description |
---|---|---|
document | ITextDocument | The ITextDocument in which to search. |
source | object | The optional source of the text change, which is most often an editor view if specified. |
options | ISearchOptions | The ISearchOptions to use. |
startOffset | int | The offset at which to start the search. |
canWrap | bool | Whether the search can wrap at the end of the search text range. |
searchTextRange | TextRange | The TextRange of offsets to search.
If all should be searched, specify the range |
Returns
- ISearchResultSet:
An ISearchResultSet that specifies the result of the operation.