-
Notifications
You must be signed in to change notification settings - Fork 32k
Adds support for moving the tab close button to the left #17863
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
Hi @reaktivo, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
I've signed the CLA. |
db61f80
to
b604568
Compare
Hi @reaktivo, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! The agreement was validated by Microsoft and real humans are currently evaluating your PR. TTYL, MSBOT; |
@reaktivo good stuff, elegant CSS solution 👍 . Now that I see both I would still support |
@reaktivo are you still working on this? |
Also uses the tab close button option to position the dirty indicator
5cce9f2
to
0cd9cda
Compare
@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. |
…port-tab-close-button-on-left
There was a problem hiding this 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; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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'
)
@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? |
@reaktivo I am not sure I understand, here is how I expect this to work:
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. |
@bpasero I've updated the PR with the requested changes, the builds are failing with non-specified errors, can you retrigger the builds? |
Hi @reaktivo, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! The agreement was validated by Microsoft and real humans are currently evaluating your PR. TTYL, MSBOT; |
@bpasero I rerun the build and it's passing now. |
@reaktivo thanks, checking it later today. |
@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:
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:
? |
e724c7f
to
660457a
Compare
660457a
to
3eaac7f
Compare
@bpasero Updated |
@reaktivo awesome 👍 |
This makes me so happy! Thank you @reaktivo ❤️ |
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 theshowTabCloseButton
andtabCloseButtonOnLeft
into a single setting specifying if it's hidden or on which side should it be displayed.Fixes #15833