mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 15:33:56 +08:00
refactor(protobuf): share the summary excerpt boundary (#17339)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user