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

Long paths are truncated in watch mode #30

Open
tcbegley opened this issue Aug 2, 2018 · 10 comments
Open

Long paths are truncated in watch mode #30

tcbegley opened this issue Aug 2, 2018 · 10 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@tcbegley
Copy link
Contributor

tcbegley commented Aug 2, 2018

When using watch mode on a large project with many nested directories, I see only the first part of the path before it gets truncated. In particular the actual file name is hidden. Resizing the window has no effect.

image

Would it be possible to display something like notebooks/.../folder/notebook_name.ipynb etc.?

@janfreyberg
Copy link
Contributor

good catch @tcbegley , thanks

@pbugnion
Copy link
Contributor

pbugnion commented Aug 3, 2018

What would be the most useful here? Something like notebooks/.../<last-directory>/<filename>?

@tcbegley
Copy link
Contributor Author

tcbegley commented Aug 3, 2018

For me that would be perfect

@janfreyberg
Copy link
Contributor

janfreyberg commented Aug 3, 2018

I reckon what makes sense is to recursively remove directories before the last directory until it gets to an acceptable path length

@janfreyberg janfreyberg self-assigned this Aug 3, 2018
@srstevenson
Copy link
Contributor

An alternative which provides more context than eliding intermediate directory names is to keep only the first character of each parent directory's name. For example, /project/some/very/long/nested/path/foo.ipynb would be displayed as /p/n/s/v/l/n/p/foo.ipynb. This is especially useful if the project contains multiple directories with generic names used in multiple places. For example:

$ tree /project 
/project
├── exploration
│   ├── doc
│   ├── notebooks
│   └── src
├── modelling
│   ├── doc
│   ├── notebooks
│   └── src
└── visualisation
    ├── doc
    ├── notebooks
    └── src

@janfreyberg
Copy link
Contributor

I think just sticking a single letter in there is a bit confusing. I've just written something that replaces the longest directory with the first letter + … recursively, and if that doesn't get it below the char limit, it starts removing directories entirely (replacing with a single …)

Does this seem reasonable?

_trim_path('/hi/this/is/a/really_really/reeeeeeeeeeeeeeeeeally/loooooooooooooooooooooong/path.file')
'hi/this/is/a/really_really/r…/l…/path.file'

@srstevenson
Copy link
Contributor

To me that's more confusing than always reducing to a single character. Additionally, it's less apparent why a particular directory name has been elided than if it was just applied left-to-right, for example.

@pbugnion
Copy link
Contributor

pbugnion commented Aug 3, 2018

Thanks for everyone's contributions and enthusiasm.

Scott's suggestion is fairly common (the Fish prompt does this by default, I think, or maybe it's just my prompt), and should therefore be fairly familiar. That said, I think Jan's idea of having a first letter + ... is somewhat more legible, at the cost of an extra character. Ultimately I don't really care -- I think we should just try it.

In terms of where to truncate, I believe it'd be more aligned with people's expectations (and probably more useful) to start truncating directories at the beginning of the path rather than at the end, or rather than choosing the longest directories:

/hi/this/is/a/really_really/reeeeeeeeeeeeeeeeeally/loooooooooooooooooooooong/path.file
=>
/h/t/i/a/r/r/loooooooooooooooooooooong/path.file
/h…/t…/i…/a…/r…/loooooooooooooooooooooong/path.file

Can we just test that the ellipsis character prints reasonably on the Cygwin terminal in the Windows computer?

@janfreyberg
Copy link
Contributor

will do @pbugnion!

@janfreyberg
Copy link
Contributor

Can confirm that this does indeed print in cygwin.

@srstevenson srstevenson added enhancement New feature or request good first issue Good for newcomers labels Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Development

No branches or pull requests

4 participants