Add pinned tab button (icon) control setting (#196896)

* add pinned tab button (icon) control setting - workbench.editor.pinnedTabButton

* Update editor tab unpin action

* Update editor tab action buttons location and visibility settings mechanics

* Mount tab action button visibility into intermediate TabAction class

* Refactor editor tab actions and settings

---------

Co-authored-by: BeniBenj <besimmonds@microsoft.com>
This commit is contained in:
n-gist
2023-10-31 14:09:53 +06:00
committed by GitHub
parent 841dc70e4a
commit 5240f7230a
5 changed files with 74 additions and 33 deletions

View File

@@ -143,11 +143,21 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
}
}
},
'workbench.editor.tabCloseButton': {
'type': 'string',
'enum': ['left', 'right', 'off'],
'default': 'right',
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'editorTabCloseButton' }, "Controls the position of the editor's tabs close buttons, or disables them when set to 'off'. This value is ignored when `#workbench.editor.showTabs#` is not set to `multiple`.")
'workbench.editor.tabActionLocation': {
type: 'string',
enum: ['left', 'right'],
default: 'right',
markdownDescription: localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabActionLocation' }, "Controls the position of the editor's tabs action buttons (close, unpin). This value is ignored when `#workbench.editor.showTabs#` is not set to `multiple`.")
},
'workbench.editor.tabActionCloseVisibility': {
type: 'boolean',
default: true,
description: localize('workbench.editor.tabActionCloseVisibility', "Controls the visibility of the tab close action button.")
},
'workbench.editor.tabActionUnpinVisibility': {
type: 'boolean',
default: true,
description: localize('workbench.editor.tabActionUnpinVisibility', "Controls the visibility of the tab unpin action button.")
},
'workbench.editor.tabSizing': {
'type': 'string',
@@ -802,6 +812,16 @@ Registry.as<IConfigurationMigrationRegistry>(Extensions.ConfigurationMigration)
}
return [['workbench.editor.showTabs', { value: value }]];
}
}, {
key: 'workbench.editor.tabCloseButton', migrateFn: (value: any) => {
const result: ConfigurationKeyValuePairs = [];
if (value === 'left' || value === 'right') {
result.push(['workbench.editor.tabActionLocation', { value }]);
} else if (value === 'off') {
result.push(['workbench.editor.tabActionCloseVisibility', { value: false }]);
}
return result;
}
}, {
key: 'zenMode.hideTabs', migrateFn: (value: any) => {
const result: ConfigurationKeyValuePairs = [['zenMode.hideTabs', { value: undefined }]];