| 4620 | // Separate caps preserve the retry instruction and complete candidate |
| 4621 | // names even with long queries or generated identifiers. |
| 4622 | const cappedList = (words: string[], cap: number) => { |
| 4623 | const kept: string[] = []; |
| 4624 | for (const word of words) { |
| 4625 | if (list([...kept, word]).length > cap) break; |
| 4626 | kept.push(word); |
| 4627 | } |
| 4628 | return list(kept) + (kept.length < words.length ? ' …' : ''); |
| 4629 | }; |
| 4630 | explanation += '\nChecked indexed names, signatures, docstrings (FTS prefixes) and live name segments; not all source text.'; |
| 4631 | if (miss.limited) explanation += '\nWord check limited to 16 words of at most 64 characters.'; |
| 4632 | explanation += `\nNo lexical matches for checked words: ${cappedList(miss.unmatched, 250) || '(none)'}.`; |