File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11import { spawn } from 'child_process'
2+ import * as fs from 'fs'
23import * as path from 'path'
34
45import { formatCodeSearchOutput } from '../../../common/src/util/format-code-search'
@@ -67,8 +68,16 @@ export function codeSearch({
6768 // -n shows line numbers
6869 // --json outputs in JSON format, which streams in and allows us to cut off the output if it grows too long
6970 // "--"" prevents pattern from being misparsed as a flag (e.g., pattern starting with '-')
70- // Search paths: '.' plus blessed hidden directories (ripgrep ignores non-existent paths)
71- const searchPaths = [ '.' , ...INCLUDED_HIDDEN_DIRS ]
71+ // Search paths: '.' plus blessed hidden directories that actually exist
72+ // Filter out non-existent directories to avoid ripgrep stderr errors
73+ const existingHiddenDirs = INCLUDED_HIDDEN_DIRS . filter ( ( dir ) => {
74+ try {
75+ return fs . statSync ( path . join ( searchCwd , dir ) ) . isDirectory ( )
76+ } catch {
77+ return false
78+ }
79+ } )
80+ const searchPaths = [ '.' , ...existingHiddenDirs ]
7281 const args = [
7382 '--no-config' ,
7483 '-n' ,
You can’t perform that action at this time.
0 commit comments