Search for query across all (filtered) source files.
The text, regex pattern, or symbol name to find.
Search mode and optional file filter / result limit.
Array of SearchResult objects ordered by file then line.
Like search, but also reports which files were covered. Callers should
surface coverage whenever a search returns 0 hits: an empty result only
proves absence within the covered files.
Searches source files in a ts-morph
Projectby text, regex, or symbol name, using three modes:text- literal string search (case-sensitive substring)pattern- regular-expression searchsymbol- TypeScript declaration search (class, function, interface, enum, type alias, variable)Remarks
The project must already have the relevant source files added before calling CodebaseSearcher.search. For
symbolmode only top-level named declarations are indexed; local variables and anonymous expressions are not returned.When
rootDiris given,textandpatternmodes additionally scan files under that directory which are not part of the ts-morph program: Angular templates (.html) and.tsfiles outside the tsconfig (for examplesrc/i18n/*.ts).node_modules,dist,.angular,coverage,out-tscand hidden directories are skipped. Use CodebaseSearcher.searchWithCoverage to learn how many files were actually searched.Example