onEndResolve(context: Context) { const reflections = Object.values(context.project.reflections); reflections.forEach((reflection) => { reflection.comment && LinkPlugin.replaceAnnotations(reflection.comment, reflections); if (reflection instanceof DeclarationReflection) { reflection.signatures?.forEach((sig) => { sig.comment && LinkPlugin.replaceAnnotations(sig.comment, reflections); }); } if (reflection instanceof SignatureReflection) { reflection.parameters?.forEach((param) => { param.comment && LinkPlugin.replaceAnnotations(param.comment, reflections); }); } }); }
private populateOrder(children: Reflection[] = []) { const MAGIC = 100_000; function findOrderAndRemove(comment?: Comment) { const orderTag = (comment?.tags || []).find((tag) => tag.tagName === 'order'); if (orderTag) { comment.removeTags('order'); // CommentPlugin.removeTags(comment, 'order'); return parseInt(orderTag.text, 10) - MAGIC; } } function getOrder(reflection: Reflection) { if (reflection.hasComment()) { return findOrderAndRemove(reflection.comment); } else if (reflection instanceof DeclarationReflection) { return findOrderAndRemove(reflection.signatures?.[0]?.comment); } return 0; } children.forEach((reflection) => { if (!CubejsGroupPlugin.orderByName.has(reflection.name)) { CubejsGroupPlugin.orderByName.set(reflection.name, getOrder(reflection) || 0); } }); }