]> Repositorios git - classgraph.git/commitdiff
Mention package + module in external-class panel description
authorJavier Sagredo <[email protected]>
Wed, 6 May 2026 23:18:12 +0000 (01:18 +0200)
committerJavier Sagredo <[email protected]>
Wed, 6 May 2026 23:51:06 +0000 (01:51 +0200)
The "External (not defined in this program)" status line was
informationless — the QualName already carried the package and
module the class came from. Surface them in the description with a
hint that the user can extend their plugin run to capture the class
locally if that data would be useful.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
data/viewer.js

index 4e20c6d454adcd066309c40fab4f94aa95af56a2..677aaf5c5d850b63afe5844102c215d9d1a4b904 100644 (file)
   }
 
   function renderExternalClassPanel(d) {
+    const pkg = d.package || '';
+    const mod = d.module  || '';
+    // Build the most informative description we can from whatever
+    // package/module info the dump preserved. The plugin records both
+    // for every QualName, so for a normal external reference both are
+    // present.
+    let status;
+    if (pkg && mod) {
+      status = `Defined in module <code>${escape(mod)}</code> ` +
+               `(package <code>${escape(pkg)}</code>) — not extracted by ` +
+               `the plugin in this program. Add the package to your ` +
+               `plugin run if you'd like its instances and superclasses ` +
+               `to surface here.`;
+    } else if (mod) {
+      status = `Defined in module <code>${escape(mod)}</code> — not ` +
+               `extracted by the plugin in this program.`;
+    } else if (pkg) {
+      status = `Defined in package <code>${escape(pkg)}</code> — not ` +
+               `extracted by the plugin in this program.`;
+    } else {
+      status = `Referenced but not extracted by the plugin in this program.`;
+    }
     return `
       <h2>${escape(d.label)}</h2>
-      <p class="pkgmod">${escape(d.package || '')} · ${escape(d.module || '')}</p>
+      <p class="pkgmod">${escape(pkg)} · ${escape(mod)}</p>
       ${panelButtons(d.id, { canPin: false, canMute: true })}
       <dl>
-        <dt>Status</dt><dd><em>External (not defined in this program)</em></dd>
+        <dt>Status</dt><dd>${status}</dd>
       </dl>`;
   }