refactor(protobuf): share the summary excerpt boundary (#17339)

This commit is contained in:
Vincent Koc
2026-12-06 10:55:03 +08:00
committed by GitHub
parent 3c25661f73
commit bde0d92822
@@ -13,6 +13,7 @@ import { invalidAnalysisView } from "./analysisViewErrors.js";
import { createAnalysisViewResultReader } from "./analysisViewParent.js";
import { boundedViewLimitations } from "./analysisViewCoverage.js";
import { boundedList } from "../boundedList.js";
import { excerptEnd } from "../excerpt.js";
/** Files listed in the summary; the rest stay in the complete parent. */
const SUMMARY_FILES = 32;
@@ -68,13 +69,7 @@ export const projectProtobufDescriptorsView = (
const bound = (value: string): string => {
if (value.length <= SUMMARY_TEXT_UNITS) return value;
textTruncated = true;
const last = value.charCodeAt(SUMMARY_TEXT_UNITS - 1);
return value.slice(
0,
last >= 0xd800 && last <= 0xdbff
? SUMMARY_TEXT_UNITS - 1
: SUMMARY_TEXT_UNITS,
);
return value.slice(0, excerptEnd(value, SUMMARY_TEXT_UNITS));
};
const listed = boundedList(report.descriptors, SUMMARY_FILES);
const missing = boundedList(report.missing_dependencies, SUMMARY_MISSING);