MCPcopy Index your code
hub / github.com/modem-dev/hunk / expansionCacheKey

Function expansionCacheKey

src/ui/diff/diffSectionGeometry.ts:77–93  ·  view source on GitHub ↗

Stable suffix that captures expansion state for the geometry cache key.

(
  expandedKeys: ReadonlySet<string>,
  sourceStatus: FileSourceStatus | undefined,
)

Source from the content-addressed store, hash-verified

75
76/** Stable suffix that captures expansion state for the geometry cache key. */
77function expansionCacheKey(
78 expandedKeys: ReadonlySet<string>,
79 sourceStatus: FileSourceStatus | undefined,
80) {
81 if (expandedKeys.size === 0) {
82 return "";
83 }
84
85 const sortedKeys = [...expandedKeys].sort().join(",");
86 const statusKey =
87 sourceStatus === undefined
88 ? "pending"
89 : sourceStatus.kind === "loaded"
90 ? `loaded:${sourceTextFingerprint(sourceStatus.text)}`
91 : sourceStatus.kind;
92 return `:${sortedKeys}:${statusKey}`;
93}
94
95interface SectionGeometryCacheEntry {
96 key: string;

Callers 1

Calls 1

sourceTextFingerprintFunction · 0.70

Tested by

no test coverage detected