fix(sidebar): improve tree item comment layout

This commit is contained in:
zhangsan authored and GitHub committed 2026-07-19 14:55:42 +08:00
1 parent 6b975cf797
commit 01ecb6020c
3 files changed
+147 -42

No files matched your search

@@ -54,8 +54,14 @@ export function treeItemPaddingLeft(depth: number): string {
return `${depth * 16 + 8}px`;
}
export function usesFullWidthTreeLabel(type: TreeNodeType, allowHorizontalScroll: boolean): boolean {
return allowHorizontalScroll && fullWidthLabelTypes.has(type);
export const trailingCommentGapPx = 8;
export function trailingCommentAvailableWidth(containerWidth: number, leadingWidth: number): number {
return Math.max(0, Math.floor(containerWidth - leadingWidth - trailingCommentGapPx));
}
export function usesFullWidthTreeLabel(type: TreeNodeType, allowHorizontalScroll: boolean, hasTrailingComment = false): boolean {
return allowHorizontalScroll && !hasTrailingComment && fullWidthLabelTypes.has(type);
}
export function treeLabelWidthClass({ fullWidth, hasTrailingComment }: { fullWidth: boolean; hasTrailingComment: boolean }): string {