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

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

Conversation

reaktivo
Copy link
Contributor

@reaktivo reaktivo commented Dec 27, 2016

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
Copy link

Hi @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 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
Contributor Author

I've signed the CLA.

@reaktivo reaktivo force-pushed the feature-15833-support-tab-close-button-on-left branch from db61f80 to b604568 Compare December 28, 2016 14:46
@bpasero bpasero closed this Jan 2, 2017
@bpasero bpasero reopened this Jan 2, 2017
@msftclas
Copy link

msftclas commented Jan 2, 2017

Hi @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
Copy link
Member

bpasero commented Jan 4, 2017

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

bpasero commented Jan 13, 2017

@reaktivo are you still working on this?

Also uses the tab close button option to position the dirty indicator
@reaktivo 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
Contributor Author

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

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.

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

@@ -211,7 +211,8 @@ export class EditorGroupsControl implements IEditorGroupsControl, IVerticalSashL
}

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
Member

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.

@@ -249,7 +250,7 @@ export class EditorGroupsControl implements IEditorGroupsControl, IVerticalSashL
}

// 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
Member

Choose a reason for hiding this comment

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

...same here

@@ -145,7 +145,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
previewEditors: editorConfig.enablePreview,
showIcons: editorConfig.showIcons,
showTabs: editorConfig.showTabs,
showTabCloseButton: editorConfig.showTabCloseButton
showTabCloseButton: editorConfig.showTabCloseButton,
Copy link
Member

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.

@@ -349,6 +349,18 @@ export class TabsTitleControl extends TitleControl {
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
Member

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.

@@ -898,6 +898,7 @@ export interface IWorkbenchEditorConfiguration {
editor: {
showTabs: boolean;
showTabCloseButton: boolean;
tabCloseButton: 'left' | 'right' | 'off';
Copy link
Member

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
Member

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.

@@ -22,6 +22,7 @@ export const IEditorGroupService = createDecorator<IEditorGroupService>('editorG
export interface ITabOptions {
showTabs?: boolean;
showTabCloseButton?: boolean;
tabCloseButton?: string;
Copy link
Member

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
Contributor Author

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

bpasero commented Jan 16, 2017

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

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

@reaktivo reaktivo closed this Jan 17, 2017
@reaktivo reaktivo reopened this Jan 17, 2017
@msftclas
Copy link

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

reaktivo commented Jan 17, 2017

@bpasero I rerun the build and it's passing now.

@bpasero
Copy link
Member

bpasero commented Jan 17, 2017

@reaktivo thanks, checking it later today.

@bpasero
Copy link
Member

bpasero commented Jan 17, 2017

@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 reaktivo force-pushed the feature-15833-support-tab-close-button-on-left branch from e724c7f to 660457a Compare January 17, 2017 22:45
@reaktivo 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
Contributor Author

@bpasero Updated

@bpasero bpasero merged commit 836afa4 into microsoft:master Jan 18, 2017
@bpasero
Copy link
Member

bpasero commented Jan 18, 2017

@reaktivo awesome 👍

@bpasero bpasero added this to the January 2017 milestone Jan 18, 2017
@billiegoose
Copy link

This makes me so happy! Thank you @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