diff --git a/src/vs/base/browser/ui/splitview/panelview.css b/src/vs/base/browser/ui/splitview/panelview.css index 50a7d87499a89145b91cef53a222c10b8b64f981..51e31aa0d215bf8ec128aeee267c5ccd507de84d 100644 --- a/src/vs/base/browser/ui/splitview/panelview.css +++ b/src/vs/base/browser/ui/splitview/panelview.css @@ -54,6 +54,7 @@ /* TODO: actions should be part of the panel, but they aren't yet */ .monaco-panel-view .panel:hover > .panel-header.expanded > .actions, +.monaco-panel-view .panel > .panel-header.actions-always-visible.expanded > .actions, .monaco-panel-view .panel > .panel-header.focused.expanded > .actions { display: initial; } diff --git a/src/vs/workbench/browser/parts/views/panelViewlet.ts b/src/vs/workbench/browser/parts/views/panelViewlet.ts index 03fb2022e2ced148831571b3705110b2ac81d789..fadd654b2735505054ada1b3252d3d021f48b41d 100644 --- a/src/vs/workbench/browser/parts/views/panelViewlet.ts +++ b/src/vs/workbench/browser/parts/views/panelViewlet.ts @@ -11,7 +11,7 @@ import { ColorIdentifier, contrastBorder } from 'vs/platform/theme/common/colorR import { attachStyler, IColorMapping, IThemable } from 'vs/platform/theme/common/styler'; import { SIDE_BAR_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND } from 'vs/workbench/common/theme'; import { Dimension, Builder } from 'vs/base/browser/builder'; -import { append, $, trackFocus } from 'vs/base/browser/dom'; +import { append, $, trackFocus, toggleClass } from 'vs/base/browser/dom'; import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle'; import { firstIndex } from 'vs/base/common/arrays'; import { IAction, IActionRunner } from 'vs/base/common/actions'; @@ -25,6 +25,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { PanelView, IPanelViewOptions, IPanelOptions, Panel } from 'vs/base/browser/ui/splitview/panelview'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export interface IPanelColors extends IColorMapping { dropBackground?: ColorIdentifier; @@ -54,15 +55,19 @@ export abstract class ViewletPanel extends Panel { protected actionRunner: IActionRunner; protected toolbar: ToolBar; + private updateActionVisibilityPreferences: () => void = () => { }; + constructor( readonly title: string, options: IViewletPanelOptions, @IKeybindingService protected keybindingService: IKeybindingService, - @IContextMenuService protected contextMenuService: IContextMenuService + @IContextMenuService protected contextMenuService: IContextMenuService, + @IConfigurationService protected readonly configurationService: IConfigurationService ) { super(options); this.actionRunner = options.actionRunner; + this.configurationService.onDidChangeConfiguration(() => this.updateActionVisibilityPreferences()); } render(container: HTMLElement): void { @@ -76,6 +81,9 @@ export abstract class ViewletPanel extends Panel { protected renderHeader(container: HTMLElement): void { this.renderHeaderTitle(container); + this.updateActionVisibilityPreferences = () => toggleClass(container, 'actions-always-visible', this.shouldAlwaysShowActions()); + this.updateActionVisibilityPreferences(); + const actions = append(container, $('.actions')); this.toolbar = new ToolBar(actions, this.contextMenuService, { orientation: ActionsOrientation.HORIZONTAL, @@ -102,6 +110,10 @@ export abstract class ViewletPanel extends Panel { this.toolbar.context = this.getActionsContext(); } + private shouldAlwaysShowActions(): boolean { + return this.configurationService.getValue('workbench.panel.alwaysShowActions'); + } + getActions(): IAction[] { return []; } diff --git a/src/vs/workbench/browser/parts/views/treeView.ts b/src/vs/workbench/browser/parts/views/treeView.ts index d295d2728a10e3fe366bf4f8fc783cd8e5130039..92e23e03e4902cf91a80908eb7651da66dcc54da 100644 --- a/src/vs/workbench/browser/parts/views/treeView.ts +++ b/src/vs/workbench/browser/parts/views/treeView.ts @@ -28,6 +28,7 @@ import { TreeViewsViewletPanel, IViewletViewOptions, IViewOptions } from 'vs/wor import { ICommandService } from 'vs/platform/commands/common/commands'; import { TreeItemCollapsibleState, ITreeItem, ITreeViewDataProvider, TreeViewItemHandleArg } from 'vs/workbench/common/views'; import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export class TreeView extends TreeViewsViewletPanel { @@ -48,9 +49,10 @@ export class TreeView extends TreeViewsViewletPanel { @IThemeService private themeService: IThemeService, @IContextKeyService private contextKeyService: IContextKeyService, @IExtensionService private extensionService: IExtensionService, - @ICommandService private commandService: ICommandService + @ICommandService private commandService: ICommandService, + @IConfigurationService protected readonly configurationService: IConfigurationService ) { - super({ ...(options as IViewOptions), ariaHeaderLabel: options.name }, keybindingService, contextMenuService); + super({ ...(options as IViewOptions), ariaHeaderLabel: options.name }, keybindingService, contextMenuService, configurationService); this.menus = this.instantiationService.createInstance(Menus, this.id); this.menus.onDidChangeTitle(() => this.updateActions(), this, this.disposables); this.themeService.onThemeChange(() => this.tree.refresh() /* soft refresh */, this, this.disposables); diff --git a/src/vs/workbench/browser/parts/views/viewsViewlet.ts b/src/vs/workbench/browser/parts/views/viewsViewlet.ts index 7bc93ba609f0887b2f91e7ae6df114211016c4b3..92c01c96900d43e52acb27ce72b492762102892f 100644 --- a/src/vs/workbench/browser/parts/views/viewsViewlet.ts +++ b/src/vs/workbench/browser/parts/views/viewsViewlet.ts @@ -28,6 +28,7 @@ import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; import { PanelViewlet, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet'; import { IPanelOptions } from 'vs/base/browser/ui/splitview/panelview'; import { WorkbenchTree } from 'vs/platform/list/browser/listService'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export interface IViewOptions extends IPanelOptions { id: string; @@ -45,9 +46,10 @@ export abstract class ViewsViewletPanel extends ViewletPanel { constructor( options: IViewOptions, protected keybindingService: IKeybindingService, - protected contextMenuService: IContextMenuService + protected contextMenuService: IContextMenuService, + @IConfigurationService protected readonly configurationService: IConfigurationService ) { - super(options.name, options, keybindingService, contextMenuService); + super(options.name, options, keybindingService, contextMenuService, configurationService); this.id = options.id; this.name = options.name; @@ -111,9 +113,10 @@ export abstract class TreeViewsViewletPanel extends ViewsViewletPanel { constructor( options: IViewOptions, protected keybindingService: IKeybindingService, - protected contextMenuService: IContextMenuService + protected contextMenuService: IContextMenuService, + @IConfigurationService protected readonly configurationService: IConfigurationService ) { - super(options, keybindingService, contextMenuService); + super(options, keybindingService, contextMenuService, configurationService); this.id = options.id; this.name = options.name; diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index c4c442816424dc8eb8d3e9c5056a84e0582b1c7e..bfee5625d986f78fafc92e9f761c15cdad997558 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -253,6 +253,11 @@ configurationRegistry.registerConfiguration({ 'default': true, 'description': nls.localize('activityBarVisibility', "Controls the visibility of the activity bar in the workbench.") }, + 'workbench.panel.alwaysShowActions': { + 'type': 'boolean', + 'default': false, + 'description': nls.localize('panelActionVisibility', "Controls the visibility of side panel tree view actions. A panel's actions may either be always visible, or only visible when that panel is active.") + }, 'workbench.fontAliasing': { 'type': 'string', 'enum': ['default', 'antialiased', 'none'], diff --git a/src/vs/workbench/parts/debug/electron-browser/breakpointsView.ts b/src/vs/workbench/parts/debug/electron-browser/breakpointsView.ts index de6a551619b7adc2e25df78a97982e34211a9e18..54c6d9a96dc395acb28833c0c7157c5748565eb1 100644 --- a/src/vs/workbench/parts/debug/electron-browser/breakpointsView.ts +++ b/src/vs/workbench/parts/debug/electron-browser/breakpointsView.ts @@ -33,6 +33,7 @@ import { ViewsViewletPanel, IViewletViewOptions } from 'vs/workbench/browser/par import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { attachInputBoxStyler } from 'vs/platform/theme/common/styler'; import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; const $ = dom.$; @@ -54,9 +55,10 @@ export class BreakpointsView extends ViewsViewletPanel { @IThemeService private themeService: IThemeService, @IEditorService private editorService: IEditorService, @IContextViewService private contextViewService: IContextViewService, - @IContextKeyService private contextKeyService: IContextKeyService + @IContextKeyService private contextKeyService: IContextKeyService, + @IConfigurationService protected readonly configurationService: IConfigurationService ) { - super(options, keybindingService, contextMenuService); + super(options, keybindingService, contextMenuService, configurationService); this.minimumBodySize = this.maximumBodySize = this.getExpandedBodySize(); this.settings = options.viewletSettings; diff --git a/src/vs/workbench/parts/debug/electron-browser/callStackView.ts b/src/vs/workbench/parts/debug/electron-browser/callStackView.ts index 5948091a39d7c662e62a50ea99d27e5ffd8dac26..33df86d4c3e571acc5b82256992b8d1bd66b2d1e 100644 --- a/src/vs/workbench/parts/debug/electron-browser/callStackView.ts +++ b/src/vs/workbench/parts/debug/electron-browser/callStackView.ts @@ -29,6 +29,7 @@ import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listServic import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import FileResultsNavigation from 'vs/workbench/parts/files/browser/fileResultsNavigation'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; const $ = dom.$; @@ -51,8 +52,9 @@ export class CallStackView extends TreeViewsViewletPanel { @IThemeService private themeService: IThemeService, @IListService private listService: IListService, @IWorkbenchEditorService private editorService: IWorkbenchEditorService, + @IConfigurationService protected readonly configurationService: IConfigurationService, ) { - super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService); + super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService); this.settings = options.viewletSettings; // Create scheduler to prevent unnecessary flashing of tree when reacting to changes diff --git a/src/vs/workbench/parts/debug/electron-browser/variablesView.ts b/src/vs/workbench/parts/debug/electron-browser/variablesView.ts index 36384afa9f86d3952344cac67da8c5dbbff6bea4..26e5aea763b57663bcf8563f740cc4260cedb766 100644 --- a/src/vs/workbench/parts/debug/electron-browser/variablesView.ts +++ b/src/vs/workbench/parts/debug/electron-browser/variablesView.ts @@ -29,6 +29,7 @@ import { ViewModel } from 'vs/workbench/parts/debug/common/debugViewModel'; import { equalsIgnoreCase } from 'vs/base/common/strings'; import { IMouseEvent } from 'vs/base/browser/mouseEvent'; import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; const $ = dom.$; @@ -48,9 +49,10 @@ export class VariablesView extends TreeViewsViewletPanel { @IInstantiationService private instantiationService: IInstantiationService, @IListService private listService: IListService, @IContextKeyService private contextKeyService: IContextKeyService, - @IThemeService private themeService: IThemeService + @IThemeService private themeService: IThemeService, + @IConfigurationService protected readonly configurationService: IConfigurationService, ) { - super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService); + super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService); this.settings = options.viewletSettings; this.expandedElements = []; diff --git a/src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts b/src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts index 23ddbee6eff14a1dc30469ff073bfa596bd7d93d..623de77e18e485e18dfcc59bf7e72b3cdd3d8f04 100644 --- a/src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts +++ b/src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts @@ -30,6 +30,7 @@ import { IMouseEvent, DragMouseEvent } from 'vs/base/browser/mouseEvent'; import { DefaultDragAndDrop } from 'vs/base/parts/tree/browser/treeDefaults'; import { IVariableTemplateData, renderVariable, renderRenameBox, renderExpressionValue, BaseDebugController, twistiePixels, renderViewTree } from 'vs/workbench/parts/debug/electron-browser/baseDebugView'; import { WorkbenchTree, IListService } from 'vs/platform/list/browser/listService'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; const $ = dom.$; const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024; @@ -49,9 +50,10 @@ export class WatchExpressionsView extends TreeViewsViewletPanel { @IContextKeyService private contextKeyService: IContextKeyService, @IListService private listService: IListService, @IInstantiationService private instantiationService: IInstantiationService, - @IThemeService private themeService: IThemeService + @IThemeService private themeService: IThemeService, + @IConfigurationService protected readonly configurationService: IConfigurationService, ) { - super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('expressionsSection', "Expressions Section") }, keybindingService, contextMenuService); + super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('expressionsSection', "Expressions Section") }, keybindingService, contextMenuService, configurationService); this.settings = options.viewletSettings; this.onWatchExpressionsUpdatedScheduler = new RunOnceScheduler(() => { diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts index 8f6cb11fba0f0c4c0b6a1a7304e1455bd311a288..65dbab042c550d6973fd52ac318aeaa4254b4adb 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts @@ -37,6 +37,7 @@ import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; import { InstallWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceFolderRecommendedExtensionsAction } from 'vs/workbench/parts/extensions/browser/extensionsActions'; import { WorkbenchPagedList, IListService } from 'vs/platform/list/browser/listService'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export class ExtensionsListView extends ViewsViewletPanel { @@ -61,9 +62,10 @@ export class ExtensionsListView extends ViewsViewletPanel { @IExtensionTipsService private tipsService: IExtensionTipsService, @IModeService private modeService: IModeService, @ITelemetryService private telemetryService: ITelemetryService, - @IContextKeyService private contextKeyService: IContextKeyService + @IContextKeyService private contextKeyService: IContextKeyService, + @IConfigurationService protected readonly configurationService: IConfigurationService, ) { - super({ ...(options as IViewOptions), ariaHeaderLabel: options.name }, keybindingService, contextMenuService); + super({ ...(options as IViewOptions), ariaHeaderLabel: options.name }, keybindingService, contextMenuService, configurationService); } renderHeader(container: HTMLElement): void { diff --git a/src/vs/workbench/parts/files/electron-browser/views/emptyView.ts b/src/vs/workbench/parts/files/electron-browser/views/emptyView.ts index 50804c6c0cdf496a0a9094abd2dc74019fe4fd8c..f5c70b35148846f50fc5cf0f85e567699309a5e0 100644 --- a/src/vs/workbench/parts/files/electron-browser/views/emptyView.ts +++ b/src/vs/workbench/parts/files/electron-browser/views/emptyView.ts @@ -21,6 +21,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export class EmptyView extends ViewsViewletPanel { @@ -37,9 +38,10 @@ export class EmptyView extends ViewsViewletPanel { @IInstantiationService private instantiationService: IInstantiationService, @IKeybindingService keybindingService: IKeybindingService, @IContextMenuService contextMenuService: IContextMenuService, - @IWorkspaceContextService private contextService: IWorkspaceContextService + @IWorkspaceContextService private contextService: IWorkspaceContextService, + @IConfigurationService protected configurationService: IConfigurationService ) { - super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService); + super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService); this.contextService.onDidChangeWorkbenchState(() => this.setLabels()); } diff --git a/src/vs/workbench/parts/files/electron-browser/views/explorerView.ts b/src/vs/workbench/parts/files/electron-browser/views/explorerView.ts index 024b758d31ce42ce93ecaeb7593b11f56e95a71a..596b09e90121c3c7d5d71bbec30332a1ad61faa6 100644 --- a/src/vs/workbench/parts/files/electron-browser/views/explorerView.ts +++ b/src/vs/workbench/parts/files/electron-browser/views/explorerView.ts @@ -90,11 +90,11 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView @IPartService private partService: IPartService, @IKeybindingService keybindingService: IKeybindingService, @IContextKeyService private contextKeyService: IContextKeyService, - @IConfigurationService private configurationService: IConfigurationService, + @IConfigurationService protected configurationService: IConfigurationService, @IWorkbenchThemeService private themeService: IWorkbenchThemeService, @IDecorationsService decorationService: IDecorationsService ) { - super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService); + super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService); this.settings = options.viewletSettings; this.viewletState = options.viewletState; diff --git a/src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts b/src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts index d1971cbbbb4a12d3727b81e934b4ce9cf4f84962..fd4a9b4e60f784e4b2224d3def86d8fe06f1eb4c 100644 --- a/src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts +++ b/src/vs/workbench/parts/files/electron-browser/views/openEditorsView.ts @@ -73,7 +73,7 @@ export class OpenEditorsView extends ViewsViewletPanel { @ITextFileService private textFileService: ITextFileService, @IWorkbenchEditorService private editorService: IWorkbenchEditorService, @IEditorGroupService private editorGroupService: IEditorGroupService, - @IConfigurationService private configurationService: IConfigurationService, + @IConfigurationService protected configurationService: IConfigurationService, @IKeybindingService keybindingService: IKeybindingService, @IListService private listService: IListService, @IUntitledEditorService private untitledEditorService: IUntitledEditorService, @@ -85,7 +85,7 @@ export class OpenEditorsView extends ViewsViewletPanel { super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize({ key: 'openEditosrSection', comment: ['Open is an adjective'] }, "Open Editors Section"), - }, keybindingService, contextMenuService); + }, keybindingService, contextMenuService, configurationService); this.model = editorGroupService.getStacksModel(); diff --git a/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts b/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts index 156a7bb20a60dd39c7b79ef1c1a8b9611bf5b574..8741d9d5473b4faf233f902860d69cd577e32bc7 100644 --- a/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts +++ b/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts @@ -229,9 +229,10 @@ class MainPanel extends ViewletPanel { @IThemeService private themeService: IThemeService, @IContextKeyService private contextKeyService: IContextKeyService, @IListService private listService: IListService, - @IMenuService private menuService: IMenuService + @IMenuService private menuService: IMenuService, + @IConfigurationService protected readonly configurationService: IConfigurationService ) { - super(localize('scm providers', "Source Control Providers"), {}, keybindingService, contextMenuService); + super(localize('scm providers', "Source Control Providers"), {}, keybindingService, contextMenuService, configurationService); this.updateBodySize(); } @@ -699,7 +700,7 @@ export class RepositoryPanel extends ViewletPanel { @IInstantiationService protected instantiationService: IInstantiationService, @IConfigurationService protected configurationService: IConfigurationService ) { - super(repository.provider.label, {}, keybindingService, contextMenuService); + super(repository.provider.label, {}, keybindingService, contextMenuService, configurationService); this.menus = instantiationService.createInstance(SCMMenus, repository.provider); }