DefRow

tcmts.share.DefRow · #q74mpfsk · term · runs on the server

uses tcmts.share.shareNow, which uses process

A definition in a list: where it runs, its name, its type, the first line of its doc.

import { docSummary } from "#codebase/tcmts/cli/pages";
import { isTestPath } from "#codebase/tcmts/cli/testing";
import { codeHref, leafOf, Place, shareNow } from "#codebase/tcmts/share";
import type { NameRow } from "#codebase/tcmts/store";

export function DefRow({ row, full }: { row: NameRow; full?: boolean }) {
  const s = shareNow();
  const rec = s.cb.store.getDef(row.hash)!;
  const what =
    rec.kind === "file" ? "file" : rec.kind === "type" ? "type" : s.cb.store.shownSignature(rec);
  const doc = docSummary(rec);
  return (
    <div className={full ? "drow full" : "drow"}>
      <Place
        place={
          rec.kind === "term" && !isTestPath(row.path)
            ? s.cache.placement(s.cb).placeOf(row.hash).place
            : undefined
        }
      />
      <a className="mono" href={codeHref(row.path)}>
        {full ? row.path : leafOf(row.path)}
      </a>
      <span className="sig">{what}</span>
      {doc && <span className="doc">{doc}</span>}
    </div>
  );
}

uses

used by