| 4676 | // Separate caps preserve the retry instruction and complete candidate |
| 4677 | // names even with long queries or generated identifiers. |
| 4678 | const cappedList = (words: string[], cap: number) => { |
| 4679 | const kept: string[] = []; |
| 4680 | for (const word of words) { |
| 4681 | if (list([...kept, word]).length > cap) break; |
| 4682 | kept.push(word); |
| 4683 | } |
| 4684 | return list(kept) + (kept.length < words.length ? ' …' : ''); |
| 4685 | }; |
| 4686 | explanation += '\nChecked indexed names, signatures, docstrings (FTS prefixes) and live name segments; not all source text.'; |
| 4687 | if (miss.limited) explanation += '\nWord check limited to 16 words of at most 64 characters.'; |
| 4688 | explanation += `\nNo lexical matches for checked words: ${cappedList(miss.unmatched, 250) || '(none)'}.`; |