Skip to content

[trees] pull in truncation lib for more control over truncation - #415

Merged
SlexAxton merged 5 commits into
mainfrom
alex/trees/add-truncate
Mar 24, 2026
Merged

[trees] pull in truncation lib for more control over truncation#415
SlexAxton merged 5 commits into
mainfrom
alex/trees/add-truncate

Conversation

@SlexAxton

Copy link
Copy Markdown
Contributor

loosely configured for now.

image

@vercel

vercel Bot commented Mar 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierrejs-diff-demo Ready Ready Preview Mar 24, 2026 0:04am
pierrejs-docs Ready Ready Preview Mar 24, 2026 0:04am

Request Review

@blacksmith-sh

This comment has been minimized.

@blacksmith-sh

This comment has been minimized.

@SlexAxton
SlexAxton merged commit f60c7f2 into main Mar 24, 2026
8 checks passed
@SlexAxton
SlexAxton deleted the alex/trees/add-truncate branch March 24, 2026 00:05
@lucifer-yf

Copy link
Copy Markdown

@SlexAxton
image
image

When flattenEmptyDirectories: true
is enabled and the tree is rendered
in a narrow container (e.g. a
sidebar panel pushed to the right
edge), the per-segment truncation
produces a very poor visual result
— every segment gets clipped
individually, leaving a string of
disconnected ellipses like a... /
b... / c... / dd... / .... This
makes the path nearly unreadable
and wastes space with repeated ...
markers.

VS Code handles this well by
truncating the entire flattened
path as a single string at the end
(aaa / bbb / ccc /...), which keeps
as much of the path visible as
possible and is far easier to scan
at a glance. Supporting
end-truncation for the whole path
would bring @pierre/trees in line
with this established UX pattern
and significantly improve usability
in space-constrained layouts.

@SlexAxton

Copy link
Copy Markdown
Contributor Author

@lucier-yf im pulled off on other things for another week or so, but I have a WIP to simplify truncation here:

#939

I do think there's a middle ground where the last directory is still visible rather than seeing the least significant* middle directories. But I mostly agree the current thing is not ideal for very deep folders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants