* Indexed files whose symbols are missing although their content is current * — rows a content-hash comparison calls up to date (#2336). Reported by * `status`; `sync` repairs the `needsReindex` group.
()
| 2997 | * `status`; `sync` repairs the `needsReindex` group. |
| 2998 | */ |
| 2999 | getIndexHealth(): IndexHealth { |
| 3000 | const needsReindex: string[] = []; |
| 3001 | const parseErrors: string[] = []; |
| 3002 | for (const file of this.queries.getFilesWithoutNodesOrWithErrors()) { |
| 3003 | const errors = file.errors ?? []; |
| 3004 | if (hasGrammarLoadFailure(errors)) { |
| 3005 | // Stored without being parsed — its grammar could not load (#2335). |
| 3006 | needsReindex.push(file.path); |
| 3007 | } else if (file.nodeCount === 0) { |
| 3008 | // Every parse stores at least the file node, so zero nodes means a |
| 3009 | // wiped row (#1541) or a recorded failure — except file-level-only |
| 3010 | // languages and files over the size limit, which are empty on purpose. |
| 3011 | if (isFileLevelOnlyLanguage(file.language)) continue; |
| 3012 | if (errors.length === 0) needsReindex.push(file.path); |
| 3013 | else if (errors.some((e) => e.severity === 'error' || e.code === 'parse_error')) parseErrors.push(file.path); |
| 3014 | } else if (errors.some((e) => e.code === 'parse_error')) { |
| 3015 | // Parsed, but the tree had errors and no symbols survived. |
| 3016 | parseErrors.push(file.path); |
| 3017 | } |
| 3018 | } |
| 3019 | return { needsReindex, parseErrors }; |
| 3020 | } |
| 3021 | |
| 3022 | /** |
| 3023 | * Files found against files that yielded symbols, by language. Reported by |
no test coverage detected