| 798 | const MAX_TRIGGER_CLIMB = 24; |
| 799 | |
| 800 | export async function triggersForFile( |
| 801 | absPath: string, |
| 802 | language: Language, |
| 803 | sites: readonly CallSite[] |
| 804 | ): Promise<Map<string, SiteTrigger>> { |
| 805 | const out = new Map<string, SiteTrigger>(); |
| 806 | if (!JS_FAMILY.has(language) || sites.length === 0) return out; |
| 807 | const cached = await treeFor(absPath, language); |
| 808 | if (!cached) return out; |
| 809 | for (const site of sites) { |
| 810 | const key = siteKey(site); |
| 811 | if (out.has(key)) continue; |
| 812 | const t = triggerInTree(cached.tree.rootNode, cached.source, site.line, site.column ?? null); |
| 813 | if (t !== null) out.set(key, t); |
| 814 | } |
| 815 | return out; |
| 816 | } |
| 817 | |
| 818 | /** {@link triggersForFile} over source text — the test surface. */ |
| 819 | export async function triggerInSource( |