* Say which files of an answer changed on disk after they were last indexed * (#3260). A CLI answer comes straight from the index with no watcher behind * it, so the line numbers of an edited file can point at other code; `node` * and `explore` already flag such a file, and `callers`, `callees` a
(changed: string[], json: boolean | undefined)
| 416 | * as `changedOnDisk`. |
| 417 | */ |
| 418 | function warnChangedOnDisk(changed: string[], json: boolean | undefined): void { |
| 419 | if (changed.length === 0) return; |
| 420 | const named = changed.slice(0, 5).join(', ') + (changed.length > 5 ? ` and ${changed.length - 5} more` : ''); |
| 421 | const message = changed.length === 1 |
| 422 | ? `${named} changed on disk after it was last indexed, so line numbers from it may be off. Run "codegraph sync" to update the index.` |
| 423 | : `${changed.length} files changed on disk after they were last indexed (${named}), so line numbers from them may be off. Run "codegraph sync" to update the index.`; |
| 424 | if (json) console.error(`${chalk.yellow(getGlyphs().warn)} ${message}`); |
| 425 | else warn(message); |
| 426 | } |
| 427 | |
| 428 | /** "not found" (+ optional did-you-mean) when no exact symbol matches. */ |
| 429 | function formatSymbolNotFound(symbol: string, fuzzyNames: string[]): string { |