(symbol: string, language?: string)
| 161 | // --------------------------------------------------------------------------- |
| 162 | |
| 163 | export function buildRgArgs(symbol: string, language?: string): string[] { |
| 164 | const args: string[] = [ |
| 165 | "--json", |
| 166 | "--line-number", |
| 167 | "--column", |
| 168 | "--max-count", |
| 169 | "50", |
| 170 | "--max-filesize", |
| 171 | "1M", |
| 172 | "--no-messages", |
| 173 | ]; |
| 174 | |
| 175 | for (const dir of CODE_NAV_IGNORED_GLOBS) { |
| 176 | args.push("--glob", `!${dir}`); |
| 177 | } |
| 178 | |
| 179 | if (language) { |
| 180 | const rgType = RG_TYPE_MAP[language]; |
| 181 | if (rgType) args.push("--type", rgType); |
| 182 | } |
| 183 | |
| 184 | args.push("--word-regexp", "--", escapeRegex(symbol), "."); |
| 185 | |
| 186 | return args; |
| 187 | } |
| 188 | |
| 189 | // --------------------------------------------------------------------------- |
| 190 | // rg JSON output parsing |
no test coverage detected