* Gets a description of the grep operation * @param params Parameters for the grep operation * @returns A string describing the grep
()
| 282 | * @returns A string describing the grep |
| 283 | */ |
| 284 | getDescription(): string { |
| 285 | let description = `'${this.params.pattern}'`; |
| 286 | if (this.params.include) { |
| 287 | description += ` in ${this.params.include}`; |
| 288 | } |
| 289 | if (this.params.path) { |
| 290 | const resolvedPath = path.resolve( |
| 291 | this.config.getTargetDir(), |
| 292 | this.params.path, |
| 293 | ); |
| 294 | if ( |
| 295 | resolvedPath === this.config.getTargetDir() || |
| 296 | this.params.path === '.' |
| 297 | ) { |
| 298 | description += ` within ./`; |
| 299 | } else { |
| 300 | const relativePath = makeRelative( |
| 301 | resolvedPath, |
| 302 | this.config.getTargetDir(), |
| 303 | ); |
| 304 | description += ` within ${shortenPath(relativePath)}`; |
| 305 | } |
| 306 | } else { |
| 307 | // When no path is specified, indicate searching all workspace directories |
| 308 | const workspaceContext = this.config.getWorkspaceContext(); |
| 309 | const directories = workspaceContext.getDirectories(); |
| 310 | if (directories.length > 1) { |
| 311 | description += ` across all workspace directories`; |
| 312 | } |
| 313 | } |
| 314 | return description; |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * Performs the actual search using the prioritized strategies. |
nothing calls this directly
no test coverage detected