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

File path in deeply nested folders is truncated from the wrong side in quick open #156062

Closed
LangLangBart opened this issue Jul 23, 2022 · 3 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@LangLangBart
Copy link

Info

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.69.2 (latest)
  • OS Version: macOS 10.15

Steps to Reproduce:

  1. Create a very nested file structure with some long filenames and similar sounding directories.
  2. Open Quick Open (cmd+P) in vscode and search for this filename.
  3. The file path is cut off before I can see which folder the file I was trying to open is in. In macOS Spotlight the file path is cut from the left (much better).
  4. See image below for more clarity.

Screenshot 2022-07-23 at 20 52 46

related ticket(s)

possible solution

  1. Cut the file path from the left (favourite) or
  2. allow the Quick Open field to be wider.
@LangLangBart
Copy link
Author

LangLangBart commented Jul 24, 2022

Started experimenting after building from source, see diff and image below. I couldn't figure out how to truncate the entire path from the left (like in macOS Spotlight), did the next best thing and just limited the number of folders being displayed.

Diff

--- a/src/vs/workbench/services/label/common/labelService.ts
+++ b/src/vs/workbench/services/label/common/labelService.ts
@@ -251,7 +251,7 @@ export class LabelService extends Disposable implements ILabelService {
 				}
 
 				if (!relativeLabel[overlap] || relativeLabel[overlap] === formatting.separator) {
-					relativeLabel = relativeLabel.substring(1 + overlap);
+					relativeLabel = relativeLabel.substring(1 + overlap).split('/').slice(-3).join('/');
 				} else if (overlap === folderLabel.length && folder.uri.path === posix.sep) {
 					relativeLabel = relativeLabel.substring(overlap);
 				}

Putting this behind an option would be useful. e.g.
workbench.quickOpen.filePathTrim: 'noTrim' | 'headTrim'

  • noTrim: Display of the entire path, provided it is not hindered by the size of the Quick Open panel itself (default).
  • headTrim: Limiting the file path to up to three folders.

@TylerLeonhardt
Copy link
Member

/duplicate #143956

@vscodenpa vscodenpa added the *duplicate Issue identified as a duplicate of another issue(s) label Aug 2, 2022
@vscodenpa
Copy link

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

Happy Coding!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

4 participants