Function
formatSnippet
({
before,
match,
after
}: Snippet, highlightColor: (text: string) => string)
Source from the content-addressed store, hash-verified
| 82 | after: string; |
| 83 | }; |
| 84 | function formatSnippet({ |
| 85 | before, |
| 86 | match, |
| 87 | after |
| 88 | }: Snippet, highlightColor: (text: string) => string): string { |
| 89 | return chalk.dim(before) + highlightColor(match) + chalk.dim(after); |
| 90 | } |
| 91 | function extractSnippet(text: string, query: string, contextChars: number): Snippet | null { |
| 92 | // Find exact query occurrence (case-insensitive). |
| 93 | // Note: Fuse does fuzzy matching, so this may miss some fuzzy matches. |
Tested by
no test coverage detected