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

Add settings to control the tab subtitle style (#12965) #33815

Merged
merged 5 commits into from Sep 11, 2017

Conversation

Projects
None yet
3 participants
@tvald
Contributor

tvald commented Sep 4, 2017

Fixes #1469

Adds a template system for tab descriptions:

  • ${pathShort}: e.g. parent
  • ${pathMedium}: e.g. more/parent
  • ${pathLong}: e.g. workspace/even/more/parent
  • ${pathDifferential}: e.g. .../parent, when another tab shares the same title (current behavior)
@msftclas

This comment has been minimized.

Show comment
Hide comment
@msftclas

msftclas Sep 4, 2017

@tvald,
Thanks for having already signed the Contribution License Agreement. Your agreement has not been validated yet. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

msftclas commented Sep 4, 2017

@tvald,
Thanks for having already signed the Contribution License Agreement. Your agreement has not been validated yet. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@tvald

This comment has been minimized.

Show comment
Hide comment
@tvald

tvald Sep 4, 2017

Contributor

To anticipate a couple of design questions:

  1. Why use a template instead of a simple enumeration?

The template system is more flexible and future-proof than an enumeration. The comparable configuration window.title also uses a template system.

  1. Is ${pathMedium} useful?

Probably not. My initial impulse was to provide ancestor directories via ${path[0..N]}, where ${path[0]} = 'parent' all the way up to ${path[N]} = 'workspace'. However, this would abuse the template system with a faux-array syntax. I settled on pathMedium as an inoffensive partial solution for anyone who wants something in-between pathShort and pathLong.

I would prefer to see a minimal feature accepted and merged. It can then be expanded with further PRs as users figure out what they more want in the tab description.

Contributor

tvald commented Sep 4, 2017

To anticipate a couple of design questions:

  1. Why use a template instead of a simple enumeration?

The template system is more flexible and future-proof than an enumeration. The comparable configuration window.title also uses a template system.

  1. Is ${pathMedium} useful?

Probably not. My initial impulse was to provide ancestor directories via ${path[0..N]}, where ${path[0]} = 'parent' all the way up to ${path[N]} = 'workspace'. However, this would abuse the template system with a faux-array syntax. I settled on pathMedium as an inoffensive partial solution for anyone who wants something in-between pathShort and pathLong.

I would prefer to see a minimal feature accepted and merged. It can then be expanded with further PRs as users figure out what they more want in the tab description.

@bpasero bpasero added this to the On Deck milestone Sep 5, 2017

@bpasero bpasero self-assigned this Sep 5, 2017

tvald added some commits Sep 6, 2017

- Change configuration key to 'workbench.editor.tabSubtitle'.
- Change configuration type to the enum ['default', 'short', 'medium', 'long']
- Move path logic into FileEditorInput.
- Move configuration handling into GroupService/ITabOptions.
- Refactor duplicate path shortening logic.
@tvald

This comment has been minimized.

Show comment
Hide comment
@tvald

tvald Sep 7, 2017

Contributor

The requested changes are done in d8b5863. This required a couple of significant changes:

  • the configuration value is now just an enum 'default' | 'short' | 'medium' | 'long'
  • long uses the absolute path, while medium uses a path relative to the workspace root
Contributor

tvald commented Sep 7, 2017

The requested changes are done in d8b5863. This required a couple of significant changes:

  • the configuration value is now just an enum 'default' | 'short' | 'medium' | 'long'
  • long uses the absolute path, while medium uses a path relative to the workspace root
@bpasero

This comment has been minimized.

Show comment
Hide comment
@bpasero

bpasero Sep 7, 2017

Member

@tvald thanks, I will have a look tomorrow.

Member

bpasero commented Sep 7, 2017

@tvald thanks, I will have a look tomorrow.

Don't consider empty-string descriptions during de-duplication. Don't…
… show subtitle when all descriptions are identical.
@tvald

This comment has been minimized.

Show comment
Hide comment
@tvald

tvald Sep 8, 2017

Contributor

Added a couple of small fixes to handle corner cases in the de-duplication logic.

Contributor

tvald commented Sep 8, 2017

Added a couple of small fixes to handle corner cases in the de-duplication logic.

@bpasero

@tvald this took me quite some time to review, I left some comments.

Can you elaborate why you decided to rewrite the code within the if (shortenDuplicates) { branch from the version I had before? It seems to me that you could have left that code intact and just use getDescription(LONG) instead of getDescription(true) for picking the full description when there are duplicates.

Show outdated Hide outdated src/vs/workbench/electron-browser/main.contribution.ts
Show outdated Hide outdated src/vs/workbench/electron-browser/main.contribution.ts
@@ -104,6 +104,17 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = {
'description': nls.localize('showEditorTabs', "Controls if opened editors should show in tabs or not."),
'default': true
},
'workbench.editor.tabSubtitle': {

This comment has been minimized.

@bpasero

bpasero Sep 9, 2017

Member

Please also define the enumDescriptions property to get more help when typing. See https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/electron-browser/main.contribution.ts#L229 for example how we use it for the workbench.fontAliasing setting.

@bpasero

bpasero Sep 9, 2017

Member

Please also define the enumDescriptions property to get more help when typing. See https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/electron-browser/main.contribution.ts#L229 for example how we use it for the workbench.fontAliasing setting.

This comment has been minimized.

@tvald

tvald Sep 10, 2017

Contributor

done in 26db623

@tvald

tvald Sep 10, 2017

Contributor

done in 26db623

Show outdated Hide outdated src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
Show outdated Hide outdated src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
Show outdated Hide outdated src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
@tvald

This comment has been minimized.

Show comment
Hide comment
@tvald

tvald Sep 10, 2017

Contributor

Can you elaborate why you decided to rewrite the code within the if (shortenDuplicates) { branch from the version I had before?

There's probably a clean way to retain the old code, if that's desired. Some small rearrangement was necessary to switch from the template system to the enum configuration, and at the time it seemed cleaner to rewrite the whole section. I'm not attached to the new code.

Contributor

tvald commented Sep 10, 2017

Can you elaborate why you decided to rewrite the code within the if (shortenDuplicates) { branch from the version I had before?

There's probably a clean way to retain the old code, if that's desired. Some small rearrangement was necessary to switch from the template system to the enum configuration, and at the time it seemed cleaner to rewrite the whole section. I'm not attached to the new code.

@bpasero

This comment has been minimized.

Show comment
Hide comment
@bpasero

bpasero Sep 11, 2017

Member

@tvald thanks, I will keep your changes in around handling duplicates.

Member

bpasero commented Sep 11, 2017

@tvald thanks, I will keep your changes in around handling duplicates.

@bpasero bpasero merged commit 3d6f59a into Microsoft:master Sep 11, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@bpasero bpasero modified the milestones: September 2017, On Deck Sep 11, 2017

@bpasero bpasero changed the title from Add template system for tab descriptions. (#12965) to Add settings to control the tab subtitle style (#12965) Sep 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment