Skip to content

Adds support for moving the tab close button to the left - #17863

Merged
Benjamin Pasero (bpasero) merged 6 commits into
microsoft:masterfrom
reaktivo:feature-15833-support-tab-close-button-on-left
Jan 18, 2017
Merged

Benjamin Pasero (bpasero) merged 6 commits into
microsoft:masterfrom
reaktivo:feature-15833-support-tab-close-button-on-left

Conversation

@reaktivo

@reaktivo Marcel Miranda Ackerman (reaktivo) commented Dec 27, 2016 •

Copy link
Copy Markdown
Contributor

I've added support for moving the tab close button to the left of the tab. I've implemented it in the simplest way possible, by adding a new setting called tabCloseButtonOnLeft. But I'm open to opinions regarding the possibility to refactor the showTabCloseButton and tabCloseButtonOnLeft into a single setting specifying if it's hidden or on which side should it be displayed.

Fixes #15833

@msftclas

Hi Marcel Miranda Ackerman (@reaktivo), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@reaktivo Marcel Miranda Ackerman (reaktivo) changed the title Fixes #15833 Adds support for moving the tab close button to the left Adds support for moving the tab close button to the left Dec 27, 2016
@reaktivo

Copy link
Copy Markdown
Contributor Author

I've signed the CLA.

@msftclas

Hi Marcel Miranda Ackerman (@reaktivo), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@bpasero

Benjamin Pasero (bpasero) commented Jan 4, 2017 •

Copy link
Copy Markdown
Contributor

Marcel Miranda Ackerman (@reaktivo) good stuff, elegant CSS solution 👍 . Now that I see both workbench.editor.showTabCloseButton and workbench.editor.tabCloseButtonOnLeft I suggest to merge both into one with an enum, like:
workbench.editor.tabCloseButton: 'left' | 'right' | 'off'

I would still support workbench.editor.showTabCloseButton by treating it as workbench.editor.tabCloseButton: 'off' for backwards compatibility.

@bpasero

Copy link
Copy Markdown
Contributor

Marcel Miranda Ackerman (@reaktivo) are you still working on this?

Also uses the tab close button option to position the dirty indicator
@reaktivo
Marcel Miranda Ackerman (reaktivo) force-pushed the feature-15833-support-tab-close-button-on-left branch from 5cce9f2 to 0cd9cda Compare January 15, 2017 21:24
@reaktivo

Copy link
Copy Markdown
Contributor Author

Benjamin Pasero (@bpasero) Yes sure, hadn't had the time to update the PR. I just did and also included a few changes to also move the dirty file indicator when the Hide Close button setting is set to true.

@bpasero Benjamin Pasero (bpasero) left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Marcel Miranda Ackerman (@reaktivo) thanks, I gave some feedback. overall I suggest to remove the workbench.editor.showTabCloseButton setting entirely. We can release note this change for our users.

private updateTabOptions(tabOptions: ITabOptions, refresh?: boolean): void {
const showTabCloseButton = this.tabOptions ? this.tabOptions.showTabCloseButton : false;
const tabCloseButton = this.tabOptions ? this.tabOptions.tabCloseButton : 'right';
const showTabCloseButton = this.tabOptions ? this.tabOptions.showTabCloseButton : false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just delete support for showTabCloseButton option since it is now supported via your tabCloseButton setting.


// Refresh title when icons change
else if (showingIcons !== this.tabOptions.showIcons || showTabCloseButton !== this.tabOptions.showTabCloseButton) {
else if (showingIcons !== this.tabOptions.showIcons || showTabCloseButton !== this.tabOptions.showTabCloseButton || tabCloseButton !== this.tabOptions.tabCloseButton) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

...same here

showIcons: editorConfig.showIcons,
showTabs: editorConfig.showTabs,
showTabCloseButton: editorConfig.showTabCloseButton
showTabCloseButton: editorConfig.showTabCloseButton,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just delete support for showTabCloseButton option since it is now supported via your tabCloseButton setting.

tabContainer.setAttribute('role', 'presentation'); // cannot use role "tab" here due to https://github.com/Microsoft/vscode/issues/8659
DOM.addClass(tabContainer, 'tab monaco-editor-background');

if (!this.tabOptions.showTabCloseButton || this.tabOptions.tabCloseButton === 'off') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please move this into the doUpdate method above where you will notice that there already is an update for no-close-button class from the other option (that should be deleted). We need to have it there because otherwise tabs will not update live from a config change.

editor: {
showTabs: boolean;
showTabCloseButton: boolean;
tabCloseButton: 'left' | 'right' | 'off';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove showTabCloseButton

'type': 'string',
'enum': ['left', 'right', 'off'],
'default': 'right',
'description': nls.localize('editorTabCloseButton', "Controls the position of the editor's tabs close buttons.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should mention what "off" does.

export interface ITabOptions {
showTabs?: boolean;
showTabCloseButton?: boolean;
tabCloseButton?: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use string enum here ('left' | 'right' | 'off')

@reaktivo

Copy link
Copy Markdown
Contributor Author

Benjamin Pasero (@bpasero) Ok, will update today. We'll loose the (questionably necessary) ability to move the dirty indicator to the left when the close button is disabled though, that's fine right?

@bpasero

Copy link
Copy Markdown
Contributor

Marcel Miranda Ackerman (@reaktivo) I am not sure I understand, here is how I expect this to work:

  • left: dirty indicator shows on the left hand side
  • right: dirty indicator shows on the right hand side
  • off: dirty indicator shows on the right hand side

This would basically keep todays behaviour of how the dirty indicator is showing but adds on top to show it on the left hand side if enabled.

@reaktivo

Copy link
Copy Markdown
Contributor Author

Benjamin Pasero (@bpasero) I've updated the PR with the requested changes, the builds are failing with non-specified errors, can you retrigger the builds?

@msftclas

Hi Marcel Miranda Ackerman (@reaktivo), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@reaktivo

Marcel Miranda Ackerman (reaktivo) commented Jan 17, 2017 •

Copy link
Copy Markdown
Contributor Author

Benjamin Pasero (@bpasero) I rerun the build and it's passing now.

@bpasero

Copy link
Copy Markdown
Contributor

Marcel Miranda Ackerman (@reaktivo) thanks, checking it later today.

@bpasero

Copy link
Copy Markdown
Contributor

Marcel Miranda Ackerman (@reaktivo) ok we are getting there! one thing I would like to have cleaned up is the CSS classes applied to a tab depending on the options. When I look into the CSS I for example see this rule:

.tab.no-close-button.close-position-left

I think this rule should not be possible since we just have 1 setting now that controls everything. Can we not have rules like these:

.tab (default)
.tab.close-button-off
.tab.close-button-left

?

@reaktivo
Marcel Miranda Ackerman (reaktivo) force-pushed the feature-15833-support-tab-close-button-on-left branch from e724c7f to 660457a Compare January 17, 2017 22:45
@reaktivo
Marcel Miranda Ackerman (reaktivo) force-pushed the feature-15833-support-tab-close-button-on-left branch from 660457a to 3eaac7f Compare January 17, 2017 22:51
@reaktivo

Copy link
Copy Markdown
Contributor Author

Benjamin Pasero (@bpasero) Updated

@bpasero
Benjamin Pasero (bpasero) merged commit 836afa4 into microsoft:master Jan 18, 2017
@bpasero

Copy link
Copy Markdown
Contributor

Marcel Miranda Ackerman (@reaktivo) awesome 👍

@billiegoose

Copy link
Copy Markdown

This makes me so happy! Thank you Marcel Miranda Ackerman (@reaktivo) ❤️

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

Move tab close "x" to left-side for easy access

5 participants