* 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.
()
| 3067 | * `status`; `sync` repairs the `needsReindex` group. |
| 3068 | */ |
| 3069 | getIndexHealth(): IndexHealth { |
| 3070 | const needsReindex: string[] = []; |
| 3071 | const parseErrors: string[] = []; |
| 3072 | for (const file of this.queries.getFilesWithoutNodesOrWithErrors()) { |
| 3073 | const errors = file.errors ?? []; |
| 3074 | if (hasGrammarLoadFailure(errors)) { |
| 3075 | // Stored without being parsed — its grammar could not load (#2335). |
| 3076 | needsReindex.push(file.path); |
| 3077 | } else if (file.nodeCount === 0) { |
| 3078 | // Every parse stores at least the file node, so zero nodes means a |
| 3079 | // wiped row (#1541) or a recorded failure — except file-level-only |
| 3080 | // languages and files over the size limit, which are empty on purpose. |
| 3081 | if (isFileLevelOnlyLanguage(file.language)) continue; |
| 3082 | if (errors.length === 0) needsReindex.push(file.path); |
| 3083 | else if (errors.some((e) => e.severity === 'error' || e.code === 'parse_error')) parseErrors.push(file.path); |
| 3084 | } else if (errors.some((e) => e.code === 'parse_error')) { |
| 3085 | // Parsed, but the tree had errors and no symbols survived. |
| 3086 | parseErrors.push(file.path); |
| 3087 | } |
| 3088 | } |
| 3089 | return { needsReindex, parseErrors }; |
| 3090 | } |
| 3091 | |
| 3092 | /** |
| 3093 | * Files found against files that yielded symbols, by language. Reported by |
no test coverage detected