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

Show the folder path a file is in, in title of the window #66746

Merged
merged 8 commits into from Jan 24, 2019

Conversation

Projects
None yet
2 participants
@vedipen
Copy link
Member

vedipen commented Jan 18, 2019

Closes #66660

  • Adds options in the User Settings > Window: Title for showing the folder path a file is in.
  • Simplified descriptions for variables

Added variables -

  • ${activeFolderShort}: the name of the folder the file is contained in
  • ${activeFolderMedium}: the path of the folder the file is contained in, relative to the workspace folder
  • ${activeFolderLong}: the full path of the folder the file is contained in

Resulting view
screenshot

@bpasero
Copy link
Member

bpasero left a comment

@vedipen I am not a big fan of the logic in titlebarPart.ts to get the labels for short, medium and long folder. You implicitly assume that the label you get from the input is already a path, but that might not be true. A better solution imho would be to get the resource from the input and then do what the fileEditorInput does, e.g. here https://github.com/Microsoft/vscode/blob/cfd5d35/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts#L171

@vedipen

This comment has been minimized.

Copy link
Member Author

vedipen commented Jan 23, 2019

@bpasero Thanks for the feedback. Updated the logic.

@bpasero
Copy link
Member

bpasero left a comment

@vedipen I think we can still improve this a bit, specifically I think we do not need to check for file scheme but can try to support this for any resource. This would help in cases where the user opens remote resources which are not local.

As such I suggest:

  • continue to use the toResource(editor, { supportSideBySide: true }) but remove the check for file scheme
  • use resources.dirname() instead of paths.dirname() which takes care of resources
  • pass that into this.labelService.getUriLabel as before
  • use resources.basename instead of paths.basename for the short label

@bpasero bpasero added this to the December/January 2019 milestone Jan 24, 2019

@vedipen

This comment has been minimized.

Copy link
Member Author

vedipen commented Jan 24, 2019

@bpasero Is this ideal or should we add a function for getting these paths (or maybe use getDescription)?

@bpasero

This comment has been minimized.

Copy link
Member

bpasero commented Jan 24, 2019

Thanks I think its fine. I will push small tweaks after to clean up a bit.

@bpasero bpasero merged commit b80da8b into Microsoft:master Jan 24, 2019

2 checks passed

VS Code #20190124.49 succeeded
Details
license/cla All CLA requirements met.
Details

aeschli added a commit that referenced this pull request Jan 25, 2019

Show the folder path a file is in, in title of the window (#66746)
* Add active folder feature

* use urilabel instead

* use resource instead of path

* show empty instead for activeFolderShort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment