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

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

Merged
merged 8 commits into from Jan 24, 2019

Conversation

vedipen
Copy link
Contributor

@vedipen 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

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Contributor Author

vedipen commented Jan 23, 2019

@bpasero Thanks for the feedback. Updated the logic.

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Contributor 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
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
aeschli pushed a commit that referenced this pull request Jan 25, 2019
* Add active folder feature

* use urilabel instead

* use resource instead of path

* show empty instead for activeFolderShort
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a title variable to show the folder path a file is in
2 participants