(prompt: string, names: readonly string[])
| 103 | /** "general" for a short general question about the selection or the open file, "detail" for the |
| 104 | * same question asking for detail, undefined for any other prompt. `names` are the selection's. */ |
| 105 | export function generalQuestion(prompt: string, names: readonly string[]): 'general' | 'detail' | undefined { |
| 106 | const text = normalize(prompt, names); |
| 107 | const detail = new RegExp(DETAIL.source, 'u').test(text); |
| 108 | const asked = detail ? text.replace(DETAIL, ' ').replace(/\s+/g, ' ').trim() : text; |
| 109 | if (!GENERAL.some(pattern => pattern.test(asked))) return undefined; |
| 110 | return detail ? 'detail' : 'general'; |
| 111 | } |
| 112 | |
| 113 | /** "general" for a short question about the current view ("erkläre die aktuelle Hierarchie", |
| 114 | * "what am I looking at"), "detail" for the same asking for detail, undefined otherwise (H1). |
no test coverage detected