]> Repositorios git - classgraph.git/commitdiff
Show class→assoc-family links in the instance view
authorJavier Sagredo <[email protected]>
Wed, 6 May 2026 22:49:42 +0000 (00:49 +0200)
committerJavier Sagredo <[email protected]>
Wed, 6 May 2026 23:51:06 +0000 (01:51 +0200)
Until now the assoc-family edges only appeared in the classes view;
the instance view of, say, BftCrypto would show its families
(BftDSIGN, BftHash, …) only as descendants of the *individual*
fam-instances surfaced for each instance. Add an `assoc` arrow
straight from the focused class node to each entry of
`ciAssocTypes`, so the user can see what families the class
declares without having to find an instance that exercises them.

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

index 060c73936dfe0480e628472e3f58b280d5641fa2..25684adf93825ef90cf4f618dadf48c4205ce7d7 100644 (file)
     // Focus class at the top.
     const focusedId = ensureClassNode(cls.ciName, { focused: true });
 
+    // Associated type families of the focused class. Surface them up
+    // front (regardless of whether any current instance contributes a
+    // fam-instance) so the user can see at a glance which families
+    // the class declares — same `assoc` link the classes view shows.
+    cls.ciAssocTypes.forEach(famQn => {
+      const famNodeId = ensureFamilyNode(famQn);
+      const linkId = focusedId + '~~' + famNodeId;
+      if (!seenNodes.has(linkId)) {
+        seenNodes.add(linkId);
+        els.push({ group: 'edges', data: {
+          id: linkId,
+          source: focusedId,
+          target: famNodeId,
+          kind: 'assoc',
+          label: 'assoc',
+        }});
+      }
+    });
+
     // One row of instance nodes, anchored to the focused class.
     insts.forEach((inst, idx) => {
       const instId = ensureInstanceNode(inst, cls.ciName,