From: Javier Sagredo Date: Wed, 6 May 2026 23:21:02 +0000 (+0200) Subject: Render a side panel for external type families X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=38882da32f21057d1c6a481d655b2f3a4b22abc8;p=classgraph.git Render a side panel for external type families Clicking a family node not present in pdTypeFamilies (e.g. SigDSIGN from a foreign crypto package) used to render nothing — showSelection silently fell off the renderFamilyPanel branch. Add renderExternalFamilyPanel that uses the QualName's package + module to give a useful description, mirroring the external-class panel treatment. Co-Authored-By: Claude Opus 4.7 (1M context) --- diff --git a/data/viewer.js b/data/viewer.js index 677aaf5..e972479 100644 --- a/data/viewer.js +++ b/data/viewer.js @@ -1501,7 +1501,14 @@ } } else if (data.kind === 'family') { const fam = familyById.get(target.id()); - if (fam) el.innerHTML = renderFamilyPanel(fam); + if (fam) { + el.innerHTML = renderFamilyPanel(fam); + } else { + // External family — not in pdTypeFamilies but referenced + // via a FamilyApp somewhere. We still know its package and + // module from the QualName, so render a minimal panel. + el.innerHTML = renderExternalFamilyPanel(data); + } } else if (data.kind === 'instance') { el.innerHTML = renderInstancePanel(data.instance); } else if (data.kind === 'fam-instance') { @@ -1736,6 +1743,37 @@ `; } + // External family panel — the family is referenced (so we have a + // QualName with package + module), but it isn't in pdTypeFamilies. + // We don't know its kind, flavour, or arity, so we just describe + // what we *do* know. + function renderExternalFamilyPanel(d) { + const pkg = d.package || ''; + const mod = d.module || ''; + let status; + if (pkg && mod) { + status = `Defined in module ${escape(mod)} ` + + `(package ${escape(pkg)}) — not extracted ` + + `by the plugin in this program. Re-run the plugin against ` + + `the package that owns this family if you'd like its ` + + `equations to surface here.`; + } else if (mod) { + status = `Defined in module ${escape(mod)} — not ` + + `extracted by the plugin in this program.`; + } else if (pkg) { + status = `Defined in package ${escape(pkg)} — not ` + + `extracted by the plugin in this program.`; + } else { + status = `Referenced but not extracted by the plugin in this program.`; + } + return ` +

${escape(d.label)}

+

${escape(pkg)} · ${escape(mod)}

+
+
Status
${status}
+
`; + } + function renderInstancePanel(inst) { const head = escape(inst.iiClass.qnName) + ' ' + escape(renderArgsCompact(inst.iiArgs, inst.iiTyVars));