Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project path source trimming #1216

Closed
JamesNK opened this issue Dec 6, 2023 · 3 comments · Fixed by #1232
Closed

Project path source trimming #1216

JamesNK opened this issue Dec 6, 2023 · 3 comments · Fixed by #1232

Comments

@JamesNK
Copy link
Member

JamesNK commented Dec 6, 2023

I noticed that even on medium resolutions, the project path is trimmed in the middle and the end:
image

Right now, the trim in the middle happens on the server, and the trim at the end happens in the browser.

The most complicated solution is to use JavaScript to detect when trimming is required - I found some solutions here - and then trim the text in JavaScript. That would require listening to events to handle data changing and browser resize.

A simpler solution could be to trim more on the server. It's not perfect, and low resolution monitors will eventually see multiple ellipsises, but I don't think we can avoid that unless we go with a JavaScript solution described above.

I also think trimming content at the start of the path and base it around directory segments is better than arbitrarily cutting out text in the middle. It's less messy.

e.g. c:\Development\Source\aspire\MyProject\MyProject.csproj -> c:\...\aspire\MyProject\MyProject.csproj

It would be more complicated. We would need to parse the file path. Also, we would need to make sure it works with Linux/MacOS, e.g. /home/james/Development/Source/aspire/MyProject/MyProject.csproj -> /home/.../aspire/MyProject/MyProject.csproj.

@smitpatel
Copy link
Member

Should we show just csproj name and move whole path to details pane (when we do that)? Considering from the time/effort required here to improve trimming.

@JamesNK
Copy link
Member Author

JamesNK commented Dec 6, 2023

Yes, that would be an improvement.

Edit: Infact, I think the change could be made before the details pane. Show the file name only, tooltip is the full path, and add to details pane in the future.

@tlmii
Copy link
Member

tlmii commented Dec 6, 2023

I also think trimming content at the start of the path and base it around directory segments is better than arbitrarily cutting out text in the middle. It's less messy.
e.g. c:\Development\Source\aspire\MyProject\MyProject.csproj -> c:...\aspire\MyProject\MyProject.csproj
It would be more complicated. We would need to parse the file path. Also, we would need to make sure it works with Linux/MacOS, e.g. /home/james/Development/Source/aspire/MyProject/MyProject.csproj -> /home/.../aspire/MyProject/MyProject.csproj.

Should we show just csproj name and move whole path to details pane (when we do that)? Considering from the time/effort required here to improve trimming.

My initial code for what became the middle trimming actually attempted to do all of this. But even when I was reasonably confident in it (with a bunch of tests) there was a lot of ambiguity about what was "right" to do (e.g. preferring later segments over earlier segments when either would fit) and whether it covered all path types we'd see. So I shelved it and just went with something simpler, figuring it could be replaced later.

So I definitely support going with the simple route over trying to sort all of those out. A more complex answer can be done later if we get feedback saying it's necessary.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants