SearchService class
Service for searching files, content, and symbols within a project.
Constructors
- SearchService({required String projectRoot, int maxHistorySize = 50})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxHistorySize → int
-
Maximum entries kept in search history.
final
- projectRoot → String
-
Root directory of the project (used for project-scope searches).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearHistory(
) → void - Clear unpinned search history.
-
findFiles(
String globPattern, {String? rootDir, List< String> excludes = const []}) → Future<List< String> > -
Find files matching
globPatternunderrootDir(defaults to projectRoot). -
findSymbol(
String name, {SymbolKind? kind, String? rootDir}) → Future< List< SymbolMatch> > -
Find symbol definitions matching
name. -
getCachedIndex(
String path) → FileIndex? -
Retrieve a cached index for
path, or null if not indexed. -
getHistory(
) → List< SearchHistoryEntry> - Get the list of recent searches (most recent first).
-
indexFile(
String path) → Future< FileIndex> -
Build a word-position index for
pathfor fast repeated searches. -
invalidateIndex(
String path) → void -
Invalidate the cached index for
path. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
ripgrepSearch(
String pattern, {List< String> args = const [], String? directory}) → Future<SearchResult> -
Run
rg(ripgrep) withpatternand additionalargs, parsing output into SearchMatch objects. -
search(
String pattern, SearchScope scope, SearchOptions options, {String? targetPath}) → Future< SearchResult> -
Search for
patternwithin the givenscope. -
searchAndReplace(
String pattern, String replacement, SearchScope scope, SearchOptions options, {String? targetPath}) → Future< ReplaceResult> -
Search for
patternand preview replacements withreplacement. -
togglePin(
int index) → void - Pin or unpin a history entry.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited