diff --git a/src/vs/workbench/browser/parts/views/customView.ts b/src/vs/workbench/browser/parts/views/customView.ts index 5aec72c4959..eecea644351 100644 --- a/src/vs/workbench/browser/parts/views/customView.ts +++ b/src/vs/workbench/browser/parts/views/customView.ts @@ -13,7 +13,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions'; import { ContextAwareMenuEntryActionViewItem, createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { ITreeView, ITreeItem, TreeItemCollapsibleState, ITreeViewDataProvider, TreeViewItemHandleArg, ITreeViewDescriptor, IViewsRegistry, ViewContainer, ITreeItemLabel, Extensions } from 'vs/workbench/common/views'; +import { ITreeView, ITreeItem, TreeItemCollapsibleState, ITreeViewDataProvider, TreeViewItemHandleArg, ITreeViewDescriptor, IViewsRegistry, ViewContainer, ITreeItemLabel, Extensions, IViewDescriptorService } from 'vs/workbench/common/views'; import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { INotificationService } from 'vs/platform/notification/common/notification'; @@ -54,9 +54,10 @@ export class CustomTreeViewPane extends ViewPane { @IContextMenuService contextMenuService: IContextMenuService, @IConfigurationService configurationService: IConfigurationService, @IContextKeyService contextKeyService: IContextKeyService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IInstantiationService instantiationService: IInstantiationService, ) { - super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title, titleMenuId: MenuId.ViewTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title, titleMenuId: MenuId.ViewTitle }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); const { treeView } = (Registry.as(Extensions.ViewsRegistry).getView(options.id)); this.treeView = treeView; this._register(this.treeView.onDidChangeActions(() => this.updateActions(), this)); diff --git a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts index d139b8680f0..0722ccb4bf7 100644 --- a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts +++ b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts @@ -8,7 +8,7 @@ import * as nls from 'vs/nls'; import { Event, Emitter } from 'vs/base/common/event'; import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry'; import { attachStyler, IColorMapping } from 'vs/platform/theme/common/styler'; -import { SIDE_BAR_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_SECTION_HEADER_BORDER } from 'vs/workbench/common/theme'; +import { SIDE_BAR_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_SECTION_HEADER_BORDER, PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import { append, $, trackFocus, toggleClass, EventType, isAncestor, Dimension, addDisposableListener } from 'vs/base/browser/dom'; import { IDisposable, combinedDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle'; import { firstIndex } from 'vs/base/common/arrays'; @@ -25,7 +25,7 @@ import { PaneView, IPaneViewOptions, IPaneOptions, Pane, DefaultPaneDndControlle import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; -import { Extensions as ViewContainerExtensions, IView, FocusedViewContext, IViewContainersRegistry, IViewDescriptor, ViewContainer, IViewDescriptorService } from 'vs/workbench/common/views'; +import { Extensions as ViewContainerExtensions, IView, FocusedViewContext, IViewContainersRegistry, IViewDescriptor, ViewContainer, IViewDescriptorService, ViewContainerLocation, IViewPaneContainer } from 'vs/workbench/common/views'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { assertIsDefined } from 'vs/base/common/types'; @@ -34,7 +34,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; -import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer'; import { Component } from 'vs/workbench/common/component'; import { MenuId, MenuItemAction } from 'vs/platform/actions/common/actions'; import { ContextAwareMenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem'; @@ -92,6 +91,7 @@ export abstract class ViewPane extends Pane implements IView { @IContextMenuService protected contextMenuService: IContextMenuService, @IConfigurationService protected readonly configurationService: IConfigurationService, @IContextKeyService contextKeyService: IContextKeyService, + @IViewDescriptorService private viewDescriptorService: IViewDescriptorService, @IInstantiationService protected instantiationService: IInstantiationService, ) { super(options); @@ -189,6 +189,14 @@ export abstract class ViewPane extends Pane implements IView { this._onDidChangeTitleArea.fire(); } + protected getProgressLocation(): string { + return this.viewDescriptorService.getViewContainer(this.id)!.id; + } + + protected getBackgroundColor(): string { + return this.viewDescriptorService.getViewLocation(this.id) === ViewContainerLocation.Panel ? PANEL_BACKGROUND : SIDE_BAR_BACKGROUND; + } + focus(): void { if (this.element) { this.element.focus(); @@ -602,13 +610,14 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewPane[] { const panesToAdd: { pane: ViewPane, size: number, index: number }[] = []; + for (const { viewDescriptor, collapsed, index, size } of added) { const pane = this.createView(viewDescriptor, { id: viewDescriptor.id, title: viewDescriptor.name, actionRunner: this.getActionRunner(), - expanded: !collapsed + expanded: !collapsed, }); pane.render(); diff --git a/src/vs/workbench/browser/parts/views/views.ts b/src/vs/workbench/browser/parts/views/views.ts index ebce4a178e5..09da4059856 100644 --- a/src/vs/workbench/browser/parts/views/views.ts +++ b/src/vs/workbench/browser/parts/views/views.ts @@ -23,6 +23,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IPaneComposite } from 'vs/workbench/common/panecomposite'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import type { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; +import { PaneComposite } from 'vs/workbench/browser/panecomposite'; export interface IViewState { visibleGlobal: boolean | undefined; @@ -565,6 +566,27 @@ export class ViewsService extends Disposable implements IViewsService { return undefined; } + getActiveViewWithId(id: string): IView | null { + const viewContainer = this.viewDescriptorService.getViewContainer(id); + if (viewContainer) { + const location = this.viewContainersRegistry.getViewContainerLocation(viewContainer); + + if (location === ViewContainerLocation.Sidebar) { + const activeViewlet = this.viewletService.getActiveViewlet(); + if (activeViewlet?.getId() === viewContainer.id) { + return activeViewlet.getViewPaneContainer().getView(id) ?? null; + } + } else if (location === ViewContainerLocation.Panel) { + const activePanel = this.panelService.getActivePanel(); + if (activePanel?.getId() === viewContainer.id && activePanel instanceof PaneComposite) { + return activePanel.getViewPaneContainer().getView(id) ?? null; + } + } + } + + return null; + } + async openView(id: string, focus: boolean): Promise { const viewContainer = this.viewDescriptorService.getViewContainer(id); if (viewContainer) { diff --git a/src/vs/workbench/common/panecomposite.ts b/src/vs/workbench/common/panecomposite.ts index 3c6de0c3a60..e33f240f147 100644 --- a/src/vs/workbench/common/panecomposite.ts +++ b/src/vs/workbench/common/panecomposite.ts @@ -3,9 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IView } from 'vs/workbench/common/views'; +import { IView, IViewPaneContainer } from 'vs/workbench/common/views'; import { IComposite } from 'vs/workbench/common/composite'; -import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer'; export interface IPaneComposite extends IComposite { openView(id: string, focus?: boolean): IView; diff --git a/src/vs/workbench/common/viewPaneContainer.ts b/src/vs/workbench/common/viewPaneContainer.ts deleted file mode 100644 index 0c8f841fd6e..00000000000 --- a/src/vs/workbench/common/viewPaneContainer.ts +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { IAction, IActionViewItem } from 'vs/base/common/actions'; - -export interface IViewPaneContainer { - setVisible(visible: boolean): void; - isVisible(): boolean; - focus(): void; - getActions(): IAction[]; - getSecondaryActions(): IAction[]; - getActionViewItem(action: IAction): IActionViewItem | undefined; - saveState(): void; -} diff --git a/src/vs/workbench/common/views.ts b/src/vs/workbench/common/views.ts index 6978d67d497..5a8f3edbd07 100644 --- a/src/vs/workbench/common/views.ts +++ b/src/vs/workbench/common/views.ts @@ -15,10 +15,9 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService'; import { values, keys, getOrSet } from 'vs/base/common/map'; import { Registry } from 'vs/platform/registry/common/platform'; import { IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'; -import { IAction } from 'vs/base/common/actions'; +import { IAction, IActionViewItem } from 'vs/base/common/actions'; import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { flatten } from 'vs/base/common/arrays'; -import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; export const TEST_VIEW_CONTAINER_ID = 'workbench.view.extension.test'; @@ -357,6 +356,8 @@ export const IViewsService = createDecorator('viewsService'); export interface IViewsService { _serviceBrand: undefined; + getActiveViewWithId(id: string): IView | null; + openView(id: string, focus?: boolean): Promise; } @@ -375,6 +376,8 @@ export interface IViewDescriptorService { getViewContainer(viewId: string): ViewContainer | null; + getViewLocation(viewId: string): ViewContainerLocation | null; + getDefaultContainer(viewId: string): ViewContainer | null; } @@ -505,3 +508,15 @@ export interface IEditableData { startingValue?: string | null; onFinish: (value: string, success: boolean) => void; } + +export interface IViewPaneContainer { + setVisible(visible: boolean): void; + isVisible(): boolean; + focus(): void; + getActions(): IAction[]; + getSecondaryActions(): IAction[]; + getActionViewItem(action: IAction): IActionViewItem | undefined; + getView(viewId: string): IView | undefined; + saveState(): void; +} + diff --git a/src/vs/workbench/contrib/bulkEdit/browser/bulkEditPane.ts b/src/vs/workbench/contrib/bulkEdit/browser/bulkEditPane.ts index 3ea4de16047..7f98ad816fc 100644 --- a/src/vs/workbench/contrib/bulkEdit/browser/bulkEditPane.ts +++ b/src/vs/workbench/contrib/bulkEdit/browser/bulkEditPane.ts @@ -36,6 +36,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import type { IAsyncDataTreeViewState } from 'vs/base/browser/ui/tree/asyncDataTree'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; const enum State { Data = 'data', @@ -76,13 +77,14 @@ export class BulkEditPane extends ViewPane { @IContextMenuService private readonly _contextMenuService: IContextMenuService, @IContextKeyService private readonly _contextKeyService: IContextKeyService, @IStorageService private readonly _storageService: IStorageService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IKeybindingService keybindingService: IKeybindingService, @IContextMenuService contextMenuService: IContextMenuService, @IConfigurationService configurationService: IConfigurationService, ) { super( { ...options, titleMenuId: MenuId.BulkEditTitle }, - keybindingService, contextMenuService, configurationService, _contextKeyService, _instaService + keybindingService, contextMenuService, configurationService, _contextKeyService, viewDescriptorService, _instaService ); this.element.classList.add('bulk-edit-panel', 'show-file-icons'); diff --git a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts index 1c2711791de..babb3753773 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts @@ -33,6 +33,7 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import { Gesture } from 'vs/base/browser/touch'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; const $ = dom.$; @@ -66,9 +67,10 @@ export class BreakpointsView extends ViewPane { @IEditorService private readonly editorService: IEditorService, @IContextViewService private readonly contextViewService: IContextViewService, @IConfigurationService configurationService: IConfigurationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IContextKeyService contextKeyService: IContextKeyService, ) { - super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('breakpointsSection', "Breakpoints Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('breakpointsSection', "Breakpoints Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.minimumBodySize = this.maximumBodySize = getExpandedBodySize(this.debugService.getModel()); this._register(this.debugService.getModel().onDidChangeBreakpoints(() => this.onBreakpointsChange())); diff --git a/src/vs/workbench/contrib/debug/browser/callStackView.ts b/src/vs/workbench/contrib/debug/browser/callStackView.ts index a8048eab4e7..cd760ff2dfe 100644 --- a/src/vs/workbench/contrib/debug/browser/callStackView.ts +++ b/src/vs/workbench/contrib/debug/browser/callStackView.ts @@ -35,6 +35,7 @@ import { STOP_ID, STOP_LABEL, DISCONNECT_ID, DISCONNECT_LABEL, RESTART_SESSION_I import { ICommandService } from 'vs/platform/commands/common/commands'; import { CollapseAction } from 'vs/workbench/browser/viewlet'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; const $ = dom.$; @@ -92,12 +93,13 @@ export class CallStackView extends ViewPane { @IDebugService private readonly debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService, @IInstantiationService instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IEditorService private readonly editorService: IEditorService, @IConfigurationService configurationService: IConfigurationService, @IMenuService menuService: IMenuService, @IContextKeyService readonly contextKeyService: IContextKeyService, ) { - super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.callStackItemType = CONTEXT_CALLSTACK_ITEM_TYPE.bindTo(contextKeyService); this.contributedContextMenu = menuService.createMenu(MenuId.DebugCallStackContext, contextKeyService); diff --git a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts index bbb86f09dbd..52009d76a1f 100644 --- a/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts +++ b/src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts @@ -37,6 +37,7 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import type { ICompressedTreeNode } from 'vs/base/browser/ui/tree/compressedObjectTreeModel'; import type { ICompressibleTreeRenderer } from 'vs/base/browser/ui/tree/objectTree'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; const NEW_STYLE_COMPRESS = true; @@ -415,6 +416,7 @@ export class LoadedScriptsView extends ViewPane { @IContextMenuService contextMenuService: IContextMenuService, @IKeybindingService keybindingService: IKeybindingService, @IInstantiationService instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IConfigurationService configurationService: IConfigurationService, @IEditorService private readonly editorService: IEditorService, @IContextKeyService readonly contextKeyService: IContextKeyService, @@ -423,7 +425,7 @@ export class LoadedScriptsView extends ViewPane { @IDebugService private readonly debugService: IDebugService, @ILabelService private readonly labelService: ILabelService ) { - super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('loadedScriptsSection', "Loaded Scripts Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('loadedScriptsSection', "Loaded Scripts Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.loadedScriptsItemType = CONTEXT_LOADED_SCRIPTS_ITEM_TYPE.bindTo(contextKeyService); } diff --git a/src/vs/workbench/contrib/debug/browser/repl.ts b/src/vs/workbench/contrib/debug/browser/repl.ts index d9381e21706..8a679da1859 100644 --- a/src/vs/workbench/contrib/debug/browser/repl.ts +++ b/src/vs/workbench/contrib/debug/browser/repl.ts @@ -55,7 +55,7 @@ import { ReplDelegate, ReplVariablesRenderer, ReplSimpleElementsRenderer, ReplEv import { localize } from 'vs/nls'; import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { IViewsService } from 'vs/workbench/common/views'; +import { IViewsService, IViewDescriptorService } from 'vs/workbench/common/views'; const $ = dom.$; @@ -109,6 +109,7 @@ export class Repl extends ViewPane implements IPrivateReplService, IHistoryNavig @IModelService private readonly modelService: IModelService, @IContextKeyService private readonly contextKeyService: IContextKeyService, @ICodeEditorService codeEditorService: ICodeEditorService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IContextMenuService contextMenuService: IContextMenuService, @IConfigurationService configurationService: IConfigurationService, @ITextResourcePropertiesService private readonly textResourcePropertiesService: ITextResourcePropertiesService, @@ -116,7 +117,7 @@ export class Repl extends ViewPane implements IPrivateReplService, IHistoryNavig @IEditorService private readonly editorService: IEditorService, @IKeybindingService keybindingService: IKeybindingService ) { - super({ ...(options as IViewPaneOptions), id: REPL_VIEW_ID, ariaHeaderLabel: localize('debugConsole', "Debug Console") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), id: REPL_VIEW_ID, ariaHeaderLabel: localize('debugConsole', "Debug Console") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.history = new HistoryNavigator(JSON.parse(this.storageService.get(HISTORY_STORAGE_KEY, StorageScope.WORKSPACE, '[]')), 50); codeEditorService.registerDecorationType(DECORATION_KEY, {}); diff --git a/src/vs/workbench/contrib/debug/browser/startView.ts b/src/vs/workbench/contrib/debug/browser/startView.ts index cd6218472de..7897662627d 100644 --- a/src/vs/workbench/contrib/debug/browser/startView.ts +++ b/src/vs/workbench/contrib/debug/browser/startView.ts @@ -25,6 +25,7 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode } from 'vs/base/common/keyCodes'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; const $ = dom.$; interface DebugStartMetrics { @@ -73,9 +74,10 @@ export class StartView extends ViewPane { @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, @IFileDialogService private readonly dialogService: IFileDialogService, @IInstantiationService instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @ITelemetryService private readonly telemetryService: ITelemetryService ) { - super({ ...(options as IViewPaneOptions), ariaHeaderLabel: localize('debugStart', "Debug Start Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: localize('debugStart', "Debug Start Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this._register(editorService.onDidActiveEditorChange(() => this.updateView())); this._register(this.debugService.getConfigurationManager().onDidRegisterDebugger(() => this.updateView())); } diff --git a/src/vs/workbench/contrib/debug/browser/variablesView.ts b/src/vs/workbench/contrib/debug/browser/variablesView.ts index 71b9e9f8d32..14b902b3248 100644 --- a/src/vs/workbench/contrib/debug/browser/variablesView.ts +++ b/src/vs/workbench/contrib/debug/browser/variablesView.ts @@ -31,6 +31,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { dispose } from 'vs/base/common/lifecycle'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; const $ = dom.$; let forgetScopes = true; @@ -51,10 +52,11 @@ export class VariablesView extends ViewPane { @IKeybindingService keybindingService: IKeybindingService, @IConfigurationService configurationService: IConfigurationService, @IInstantiationService instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IClipboardService private readonly clipboardService: IClipboardService, @IContextKeyService contextKeyService: IContextKeyService ) { - super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); // Use scheduler to prevent unnecessary flashing this.onFocusStackFrameScheduler = new RunOnceScheduler(async () => { diff --git a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts index e21d0c884a7..ffe3e2b7162 100644 --- a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts +++ b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts @@ -31,6 +31,7 @@ import { variableSetEmitter, VariablesRenderer } from 'vs/workbench/contrib/debu import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { dispose } from 'vs/base/common/lifecycle'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024; let ignoreVariableSetEmitter = false; @@ -48,10 +49,11 @@ export class WatchExpressionsView extends ViewPane { @IDebugService private readonly debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService, @IInstantiationService instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IConfigurationService configurationService: IConfigurationService, @IContextKeyService contextKeyService: IContextKeyService, ) { - super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('watchExpressionsSection', "Watch Expressions Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('watchExpressionsSection', "Watch Expressions Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.onWatchExpressionsUpdatedScheduler = new RunOnceScheduler(() => { this.needsRefresh = false; diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts index 477532889fd..e4acd0afe27 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts @@ -49,6 +49,7 @@ import { SeverityIcon } from 'vs/platform/severityIcon/common/severityIcon'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import { IMenuService } from 'vs/platform/actions/common/actions'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; // Extensions that are automatically classified as Programming Language extensions, but should be Feature extensions const FORCE_FEATURE_EXTENSIONS = ['vscode.git', 'vscode.search-result']; @@ -108,9 +109,10 @@ export class ExtensionsListView extends ViewPane { @IExtensionManagementServerService protected readonly extensionManagementServerService: IExtensionManagementServerService, @IProductService protected readonly productService: IProductService, @IContextKeyService private readonly contextKeyService: IContextKeyService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IMenuService private readonly menuService: IMenuService, ) { - super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title, showActionsAlways: true }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title, showActionsAlways: true }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.server = options.server; } @@ -866,6 +868,7 @@ export class ServerExtensionsView extends ExtensionsListView { @INotificationService notificationService: INotificationService, @IKeybindingService keybindingService: IKeybindingService, @IContextMenuService contextMenuService: IContextMenuService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IInstantiationService instantiationService: IInstantiationService, @IThemeService themeService: IThemeService, @IExtensionService extensionService: IExtensionService, @@ -883,7 +886,7 @@ export class ServerExtensionsView extends ExtensionsListView { @IMenuService menuService: IMenuService, ) { options.server = server; - super(options, notificationService, keybindingService, contextMenuService, instantiationService, themeService, extensionService, extensionsWorkbenchService, editorService, tipsService, telemetryService, configurationService, contextService, experimentService, workbenchThemeService, extensionManagementServerService, productService, contextKeyService, menuService); + super(options, notificationService, keybindingService, contextMenuService, instantiationService, themeService, extensionService, extensionsWorkbenchService, editorService, tipsService, telemetryService, configurationService, contextService, experimentService, workbenchThemeService, extensionManagementServerService, productService, contextKeyService, viewDescriptorService, menuService); this._register(onDidChangeTitle(title => this.updateTitle(title))); } diff --git a/src/vs/workbench/contrib/extensions/common/extensions.ts b/src/vs/workbench/contrib/extensions/common/extensions.ts index d54dd9ac3f2..c3264b67f81 100644 --- a/src/vs/workbench/contrib/extensions/common/extensions.ts +++ b/src/vs/workbench/contrib/extensions/common/extensions.ts @@ -13,7 +13,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { IExtensionManifest, ExtensionType } from 'vs/platform/extensions/common/extensions'; import { URI } from 'vs/base/common/uri'; -import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer'; +import { IViewPaneContainer } from 'vs/workbench/common/views'; export const VIEWLET_ID = 'workbench.view.extensions'; diff --git a/src/vs/workbench/contrib/files/browser/views/emptyView.ts b/src/vs/workbench/contrib/files/browser/views/emptyView.ts index 350b41d643c..a0880ae1d0e 100644 --- a/src/vs/workbench/contrib/files/browser/views/emptyView.ts +++ b/src/vs/workbench/contrib/files/browser/views/emptyView.ts @@ -25,6 +25,7 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { Schemas } from 'vs/base/common/network'; import { isWeb } from 'vs/base/common/platform'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; export class EmptyView extends ViewPane { @@ -37,6 +38,7 @@ export class EmptyView extends ViewPane { constructor( options: IViewletViewOptions, @IThemeService private readonly themeService: IThemeService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IInstantiationService instantiationService: IInstantiationService, @IKeybindingService keybindingService: IKeybindingService, @IContextMenuService contextMenuService: IContextMenuService, @@ -46,7 +48,7 @@ export class EmptyView extends ViewPane { @ILabelService private labelService: ILabelService, @IContextKeyService contextKeyService: IContextKeyService ) { - super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this._register(this.contextService.onDidChangeWorkbenchState(() => this.setLabels())); this._register(this.labelService.onDidChangeFormatters(() => this.setLabels())); } diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index c95939c1f74..059dfa3fa4a 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -55,6 +55,7 @@ import { attachStyler, IColorMapping } from 'vs/platform/theme/common/styler'; import { ColorValue, listDropBackground } from 'vs/platform/theme/common/colorRegistry'; import { Color } from 'vs/base/common/color'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; interface IExplorerViewColors extends IColorMapping { listDropBackground?: ColorValue | undefined; @@ -149,6 +150,7 @@ export class ExplorerView extends ViewPane { constructor( options: IViewPaneOptions, @IContextMenuService contextMenuService: IContextMenuService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IInstantiationService instantiationService: IInstantiationService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, @IProgressService private readonly progressService: IProgressService, @@ -167,7 +169,7 @@ export class ExplorerView extends ViewPane { @IClipboardService private clipboardService: IClipboardService, @IFileService private readonly fileService: IFileService ) { - super({ ...(options as IViewPaneOptions), id: ExplorerView.ID, ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), id: ExplorerView.ID, ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.resourceContext = instantiationService.createInstance(ResourceContextKey); this._register(this.resourceContext); diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index a5c809c541b..23e04225b58 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -44,6 +44,7 @@ import { isWeb } from 'vs/base/common/platform'; import { IWorkingCopyService, IWorkingCopy, WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopyService'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; const $ = dom.$; @@ -68,6 +69,7 @@ export class OpenEditorsView extends ViewPane { constructor( options: IViewletViewOptions, @IInstantiationService instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IContextMenuService contextMenuService: IContextMenuService, @IEditorService private readonly editorService: IEditorService, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService, @@ -83,7 +85,7 @@ export class OpenEditorsView extends ViewPane { super({ ...(options as IViewPaneOptions), ariaHeaderLabel: nls.localize({ key: 'openEditosrSection', comment: ['Open is an adjective'] }, "Open Editors Section"), - }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.structuralRefreshDelay = 0; this.listRefreshScheduler = new RunOnceScheduler(() => { diff --git a/src/vs/workbench/contrib/markers/browser/markersView.ts b/src/vs/workbench/contrib/markers/browser/markersView.ts index c3c6d6ab777..95398693f7e 100644 --- a/src/vs/workbench/contrib/markers/browser/markersView.ts +++ b/src/vs/workbench/contrib/markers/browser/markersView.ts @@ -50,6 +50,7 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { editorLightBulbForeground, editorLightBulbAutoFixForeground } from 'vs/platform/theme/common/colorRegistry'; import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; export function getMarkersView(panelService: IPanelService): MarkersView | undefined { const activePanel = panelService.getActivePanel(); @@ -102,6 +103,7 @@ export class MarkersView extends ViewPane implements IMarkerFilterController { constructor( options: IViewPaneOptions, @IInstantiationService instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IEditorService private readonly editorService: IEditorService, @IConfigurationService configurationService: IConfigurationService, @ITelemetryService private readonly telemetryService: ITelemetryService, @@ -113,7 +115,7 @@ export class MarkersView extends ViewPane implements IMarkerFilterController { @IKeybindingService keybindingService: IKeybindingService, @IStorageService storageService: IStorageService, ) { - super({ ...(options as IViewPaneOptions), id: Constants.MARKERS_VIEW_ID, ariaHeaderLabel: Messages.MARKERS_PANEL_TITLE_PROBLEMS }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super({ ...(options as IViewPaneOptions), id: Constants.MARKERS_VIEW_ID, ariaHeaderLabel: Messages.MARKERS_PANEL_TITLE_PROBLEMS }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.panelFoucusContextKey = Constants.MarkerPanelFocusContextKey.bindTo(contextKeyService); this.panelState = new Memento(Constants.MARKERS_PANEL_STORAGE_ID, storageService).getMemento(StorageScope.WORKSPACE); this.markersViewModel = this._register(instantiationService.createInstance(MarkersViewModel, this.panelState['multiline'])); diff --git a/src/vs/workbench/contrib/outline/browser/outlinePane.ts b/src/vs/workbench/contrib/outline/browser/outlinePane.ts index 598b4cab644..629a8001b02 100644 --- a/src/vs/workbench/contrib/outline/browser/outlinePane.ts +++ b/src/vs/workbench/contrib/outline/browser/outlinePane.ts @@ -48,6 +48,7 @@ import { IDataSource } from 'vs/base/browser/ui/tree/tree'; import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService'; import { MarkerSeverity } from 'vs/platform/markers/common/markers'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; class RequestState { @@ -257,6 +258,7 @@ export class OutlinePane extends ViewPane { constructor( options: IViewletViewOptions, @IInstantiationService private readonly _instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IThemeService private readonly _themeService: IThemeService, @IStorageService private readonly _storageService: IStorageService, @IEditorService private readonly _editorService: IEditorService, @@ -266,7 +268,7 @@ export class OutlinePane extends ViewPane { @IContextKeyService contextKeyService: IContextKeyService, @IContextMenuService contextMenuService: IContextMenuService, ) { - super(options, keybindingService, contextMenuService, _configurationService, contextKeyService, _instantiationService); + super(options, keybindingService, contextMenuService, _configurationService, contextKeyService, viewDescriptorService, _instantiationService); this._outlineViewState.restore(this._storageService); this._contextKeyFocused = OutlineViewFocused.bindTo(contextKeyService); this._contextKeyFiltered = OutlineViewFiltered.bindTo(contextKeyService); diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index 2b48dd6a82f..a6f5e8b4cae 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -367,13 +367,14 @@ class HelpPanel extends ViewPane { @IContextKeyService protected contextKeyService: IContextKeyService, @IConfigurationService protected configurationService: IConfigurationService, @IInstantiationService protected readonly instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IOpenerService protected openerService: IOpenerService, @IQuickInputService protected quickInputService: IQuickInputService, @ICommandService protected commandService: ICommandService, @IRemoteExplorerService protected readonly remoteExplorerService: IRemoteExplorerService, @IWorkbenchEnvironmentService protected readonly workbenchEnvironmentService: IWorkbenchEnvironmentService ) { - super(options, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); } protected renderBody(container: HTMLElement): void { diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index ce7da57ef73..f7424c1835a 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -6,7 +6,7 @@ import 'vs/css!./media/tunnelView'; import * as nls from 'vs/nls'; import * as dom from 'vs/base/browser/dom'; -import { IViewDescriptor, IEditableData, IViewsService } from 'vs/workbench/common/views'; +import { IViewDescriptor, IEditableData, IViewsService, IViewDescriptorService } from 'vs/workbench/common/views'; import { WorkbenchAsyncDataTree, TreeResourceNavigator } from 'vs/platform/list/browser/listService'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView'; @@ -423,6 +423,7 @@ export class TunnelPanel extends ViewPane { @IContextKeyService protected contextKeyService: IContextKeyService, @IConfigurationService protected configurationService: IConfigurationService, @IInstantiationService protected readonly instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IOpenerService protected openerService: IOpenerService, @IQuickInputService protected quickInputService: IQuickInputService, @ICommandService protected commandService: ICommandService, @@ -432,7 +433,7 @@ export class TunnelPanel extends ViewPane { @IThemeService private readonly themeService: IThemeService, @IRemoteExplorerService private readonly remoteExplorerService: IRemoteExplorerService ) { - super(options, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.tunnelTypeContext = TunnelTypeContextKey.bindTo(contextKeyService); this.tunnelCloseableContext = TunnelCloseableContextKey.bindTo(contextKeyService); this.tunnelViewFocusContext = TunnelViewFocusContextKey.bindTo(contextKeyService); diff --git a/src/vs/workbench/contrib/scm/browser/mainPane.ts b/src/vs/workbench/contrib/scm/browser/mainPane.ts index 695e9325011..5e7d5ae926f 100644 --- a/src/vs/workbench/contrib/scm/browser/mainPane.ts +++ b/src/vs/workbench/contrib/scm/browser/mainPane.ts @@ -29,7 +29,7 @@ import { renderCodicons } from 'vs/base/common/codicons'; import { escape } from 'vs/base/common/strings'; import { WorkbenchList } from 'vs/platform/list/browser/listService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IViewDescriptor } from 'vs/workbench/common/views'; +import { IViewDescriptor, IViewDescriptorService } from 'vs/workbench/common/views'; import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; @@ -184,11 +184,12 @@ export class MainPane extends ViewPane { @IContextMenuService protected contextMenuService: IContextMenuService, @ISCMService protected scmService: ISCMService, @IInstantiationService instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IContextKeyService private readonly contextKeyService: IContextKeyService, @IMenuService private readonly menuService: IMenuService, @IConfigurationService configurationService: IConfigurationService ) { - super(options, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); } protected renderBody(container: HTMLElement): void { diff --git a/src/vs/workbench/contrib/scm/browser/repositoryPane.ts b/src/vs/workbench/contrib/scm/browser/repositoryPane.ts index b443b239d66..81f88f32cd7 100644 --- a/src/vs/workbench/contrib/scm/browser/repositoryPane.ts +++ b/src/vs/workbench/contrib/scm/browser/repositoryPane.ts @@ -41,7 +41,7 @@ import { URI } from 'vs/base/common/uri'; import { FileKind } from 'vs/platform/files/common/files'; import { compareFileNames } from 'vs/base/common/comparers'; import { FuzzyScore, createMatches } from 'vs/base/common/filters'; -import { IViewDescriptor } from 'vs/workbench/common/views'; +import { IViewDescriptor, IViewDescriptorService } from 'vs/workbench/common/views'; import { localize } from 'vs/nls'; import { flatten, find } from 'vs/base/common/arrays'; import { memoize } from 'vs/base/common/decorators'; @@ -619,13 +619,14 @@ export class RepositoryPane extends ViewPane { @INotificationService private readonly notificationService: INotificationService, @IEditorService protected editorService: IEditorService, @IInstantiationService protected instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IConfigurationService protected configurationService: IConfigurationService, @IContextKeyService contextKeyService: IContextKeyService, @IMenuService protected menuService: IMenuService, @IStorageService private storageService: IStorageService, @IModelService private modelService: IModelService, ) { - super(options, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.menus = instantiationService.createInstance(SCMMenus, this.repository.provider); this._register(this.menus); diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index 30d72f81113..bbea9b6271b 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -17,7 +17,7 @@ import { ToggleCaseSensitiveKeybinding, ToggleRegexKeybinding, ToggleWholeWordKe import * as nls from 'vs/nls'; import { ICommandAction, MenuId, MenuRegistry, SyncActionDescriptor } from 'vs/platform/actions/common/actions'; import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { ConfigurationScope, Extensions as ConfigurationExtensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IFileService } from 'vs/platform/files/common/files'; @@ -28,28 +28,25 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IListService, WorkbenchListFocusContextKey, WorkbenchObjectTree } from 'vs/platform/list/browser/listService'; import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { Registry } from 'vs/platform/registry/common/platform'; -import { Extensions as PanelExtensions, PanelDescriptor, PanelRegistry } from 'vs/workbench/browser/panel'; import { defaultQuickOpenContextKey } from 'vs/workbench/browser/parts/quickopen/quickopen'; import { Extensions as QuickOpenExtensions, IQuickOpenRegistry, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen'; import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions'; import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions'; -import { Extensions as ViewExtensions, IViewsRegistry, IViewContainersRegistry, ViewContainerLocation } from 'vs/workbench/common/views'; +import { Extensions as ViewExtensions, IViewsRegistry, IViewContainersRegistry, ViewContainerLocation, IViewDescriptorService, IViewsService } from 'vs/workbench/common/views'; import { getMultiSelectedResources } from 'vs/workbench/contrib/files/browser/files'; import { ExplorerFolderContext, ExplorerRootContext, FilesExplorerFocusCondition, IExplorerService, VIEWLET_ID as VIEWLET_ID_FILES } from 'vs/workbench/contrib/files/common/files'; import { OpenAnythingHandler } from 'vs/workbench/contrib/search/browser/openAnythingHandler'; import { OpenSymbolHandler } from 'vs/workbench/contrib/search/browser/openSymbolHandler'; import { registerContributions as replaceContributions } from 'vs/workbench/contrib/search/browser/replaceContributions'; import { clearHistoryCommand, ClearSearchResultsAction, CloseReplaceAction, CollapseDeepestExpandedLevelAction, copyAllCommand, copyMatchCommand, copyPathCommand, FocusNextInputAction, FocusNextSearchResultAction, FocusPreviousInputAction, FocusPreviousSearchResultAction, focusSearchListCommand, getSearchView, openSearchView, OpenSearchViewletAction, RefreshAction, RemoveAction, ReplaceAction, ReplaceAllAction, ReplaceAllInFolderAction, ReplaceInFilesAction, toggleCaseSensitiveCommand, toggleRegexCommand, toggleWholeWordCommand, FindInFilesCommand, ToggleSearchOnTypeAction, OpenResultsInEditorAction, ExpandAllAction, OpenSearchEditorAction, toggleSearchEditorCaseSensitiveCommand, toggleSearchEditorWholeWordCommand, toggleSearchEditorRegexCommand, toggleSearchEditorContextLinesCommand } from 'vs/workbench/contrib/search/browser/searchActions'; -import { SearchPanel } from 'vs/workbench/contrib/search/browser/searchPanel'; -import { SearchView, SearchViewPosition } from 'vs/workbench/contrib/search/browser/searchView'; +import { SearchView } from 'vs/workbench/contrib/search/browser/searchView'; import { registerContributions as searchWidgetContributions } from 'vs/workbench/contrib/search/browser/searchWidget'; import * as Constants from 'vs/workbench/contrib/search/common/constants'; import { getWorkspaceSymbols } from 'vs/workbench/contrib/search/common/search'; import { ISearchHistoryService, SearchHistoryService } from 'vs/workbench/contrib/search/common/searchHistoryService'; import { FileMatchOrMatch, ISearchWorkbenchService, RenderableMatch, SearchWorkbenchService, FileMatch, Match, FolderMatch } from 'vs/workbench/contrib/search/common/searchModel'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; -import { ISearchConfiguration, ISearchConfigurationProperties, PANEL_ID, VIEWLET_ID, VIEW_ID, SearchSortOrder } from 'vs/workbench/services/search/common/search'; +import { VIEWLET_ID, VIEW_ID, SearchSortOrder } from 'vs/workbench/services/search/common/search'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { ExplorerViewPaneContainer } from 'vs/workbench/contrib/files/browser/explorerViewlet'; @@ -76,7 +73,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: Constants.SearchViewVisibleKey, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_J, handler: accessor => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { searchView.toggleQueryDetails(); } @@ -89,7 +86,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.FirstMatchFocusKey), primary: KeyMod.CtrlCmd | KeyCode.UpArrow, handler: (accessor, args: any) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { searchView.focusPreviousInputBox(); } @@ -105,7 +102,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ primary: KeyMod.WinCtrl | KeyCode.Enter }, handler: (accessor, args: any) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { const tree: WorkbenchObjectTree = searchView.getControl(); searchView.open(tree.getFocus()[0], false, true, true); @@ -119,7 +116,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, WorkbenchListFocusContextKey), primary: KeyCode.Escape, handler: (accessor, args: any) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { searchView.cancelSearch(); } @@ -135,7 +132,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ primary: KeyMod.CtrlCmd | KeyCode.Backspace, }, handler: (accessor, args: any) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { const tree: WorkbenchObjectTree = searchView.getControl(); accessor.get(IInstantiationService).createInstance(RemoveAction, tree, tree.getFocus()[0]!).run(); @@ -149,7 +146,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, Constants.MatchFocusKey), primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.KEY_1, handler: (accessor, args: any) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { const tree: WorkbenchObjectTree = searchView.getControl(); accessor.get(IInstantiationService).createInstance(ReplaceAction, tree, tree.getFocus()[0] as Match, searchView).run(); @@ -164,7 +161,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.KEY_1, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter], handler: (accessor, args: any) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { const tree: WorkbenchObjectTree = searchView.getControl(); accessor.get(IInstantiationService).createInstance(ReplaceAllAction, searchView, tree.getFocus()[0] as FileMatch).run(); @@ -179,7 +176,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.KEY_1, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter], handler: (accessor, args: any) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { const tree: WorkbenchObjectTree = searchView.getControl(); accessor.get(IInstantiationService).createInstance(ReplaceAllInFolderAction, tree, tree.getFocus()[0] as FolderMatch).run(); @@ -362,31 +359,6 @@ const ClearSearchHistoryCommand: ICommandAction = { }; MenuRegistry.addCommand(ClearSearchHistoryCommand); -CommandsRegistry.registerCommand({ - id: Constants.ToggleSearchViewPositionCommandId, - handler: (accessor) => { - const configurationService = accessor.get(IConfigurationService); - const currentValue = configurationService.getValue('search').location; - const toggleValue = currentValue === 'sidebar' ? 'panel' : 'sidebar'; - - configurationService.updateValue('search.location', toggleValue); - } -}); - -const toggleSearchViewPositionLabel = nls.localize('toggleSearchViewPositionLabel', "Toggle Search View Position"); -const ToggleSearchViewPositionCommand: ICommandAction = { - id: Constants.ToggleSearchViewPositionCommandId, - title: toggleSearchViewPositionLabel, - category -}; -MenuRegistry.addCommand(ToggleSearchViewPositionCommand); -MenuRegistry.appendMenuItem(MenuId.SearchContext, { - command: ToggleSearchViewPositionCommand, - when: Constants.SearchViewVisibleKey, - group: 'search_9', - order: 1 -}); - CommandsRegistry.registerCommand({ id: Constants.FocusSearchListCommandID, handler: focusSearchListCommand @@ -402,13 +374,11 @@ MenuRegistry.addCommand(FocusSearchListCommand); const searchInFolderCommand: ICommandHandler = (accessor, resource?: URI) => { const listService = accessor.get(IListService); - const viewletService = accessor.get(IViewletService); - const panelService = accessor.get(IPanelService); const fileService = accessor.get(IFileService); - const configurationService = accessor.get(IConfigurationService); + const viewsService = accessor.get(IViewsService); const resources = getMultiSelectedResources(resource, listService, accessor.get(IEditorService), accessor.get(IExplorerService)); - return openSearchView(viewletService, panelService, configurationService, true).then(searchView => { + return openSearchView(viewsService, true).then(searchView => { if (resources && resources.length && searchView) { return fileService.resolveAll(resources.map(resource => ({ resource }))).then(results => { const folders: URI[] = []; @@ -454,7 +424,7 @@ const FIND_IN_WORKSPACE_ID = 'filesExplorer.findInWorkspace'; CommandsRegistry.registerCommand({ id: FIND_IN_WORKSPACE_ID, handler: (accessor) => { - return openSearchView(accessor.get(IViewletService), accessor.get(IPanelService), accessor.get(IConfigurationService), true).then(searchView => { + return openSearchView(accessor.get(IViewsService), true).then(searchView => { if (searchView) { searchView.searchInFolders(); } @@ -522,51 +492,43 @@ const viewContainer = Registry.as(ViewExtensions.ViewCo order: 1 }, ViewContainerLocation.Sidebar); -Registry.as(PanelExtensions.Panels).registerPanel(PanelDescriptor.create( - SearchPanel, - PANEL_ID, - nls.localize('name', "Search"), - 'search', - 10 -)); +const viewDescriptor = { id: VIEW_ID, name: nls.localize('search', "Search"), ctorDescriptor: new SyncDescriptor(SearchView), canToggleVisibility: false, canMoveView: true }; +// Register search default location to sidebar +Registry.as(ViewExtensions.ViewsRegistry).registerViews([viewDescriptor], viewContainer); + + +// Migrate search location setting to new model class RegisterSearchViewContribution implements IWorkbenchContribution { - constructor( - @IViewletService viewletService: IViewletService, - @IPanelService panelService: IPanelService, - @IConfigurationService configurationService: IConfigurationService + @IConfigurationService configurationService: IConfigurationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService ) { - const viewsRegistry = Registry.as(ViewExtensions.ViewsRegistry); - const updateSearchViewLocation = (open: boolean) => { - const config = configurationService.getValue(); - if (config.search.location === 'panel') { - viewsRegistry.deregisterViews(viewsRegistry.getViews(viewContainer), viewContainer); - Registry.as(PanelExtensions.Panels).registerPanel(PanelDescriptor.create( - SearchPanel, - PANEL_ID, - nls.localize('name', "Search"), - 'search', - 10 - )); - if (open) { - panelService.openPanel(PANEL_ID); - } - } else { - Registry.as(PanelExtensions.Panels).deregisterPanel(PANEL_ID); - viewsRegistry.registerViews([{ id: VIEW_ID, name: nls.localize('search', "Search"), ctorDescriptor: new SyncDescriptor(SearchView, [SearchViewPosition.SideBar]), canToggleVisibility: false }], viewContainer); - if (open) { - viewletService.openViewlet(VIEWLET_ID); - } - } - }; - configurationService.onDidChangeConfiguration(e => { - if (e.affectsConfiguration('search.location')) { - updateSearchViewLocation(true); - } - }); + const data = configurationService.inspect('search.location'); - updateSearchViewLocation(false); + if (data.value === 'panel') { + viewDescriptorService.moveViewToLocation(viewDescriptor, ViewContainerLocation.Panel); + } + + if (data.userValue) { + configurationService.updateValue('search.location', undefined, ConfigurationTarget.USER); + } + + if (data.userLocalValue) { + configurationService.updateValue('search.location', undefined, ConfigurationTarget.USER_LOCAL); + } + + if (data.userRemoteValue) { + configurationService.updateValue('search.location', undefined, ConfigurationTarget.USER_REMOTE); + } + + if (data.workspaceFolderValue) { + configurationService.updateValue('search.location', undefined, ConfigurationTarget.WORKSPACE_FOLDER); + } + + if (data.workspaceValue) { + configurationService.updateValue('search.location', undefined, ConfigurationTarget.WORKSPACE); + } } } Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(RegisterSearchViewContribution, LifecyclePhase.Starting); @@ -664,7 +626,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.FileMatchOrMatchFocusKey), primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L, handler: (accessor, args: any) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { const tree: WorkbenchObjectTree = searchView.getControl(); searchView.openEditorWithMultiCursor(tree.getFocus()[0]); diff --git a/src/vs/workbench/contrib/search/browser/searchActions.ts b/src/vs/workbench/contrib/search/browser/searchActions.ts index 8105b8d43b7..06abc43baf2 100644 --- a/src/vs/workbench/contrib/search/browser/searchActions.ts +++ b/src/vs/workbench/contrib/search/browser/searchActions.ts @@ -22,19 +22,16 @@ import { IReplaceService } from 'vs/workbench/contrib/search/common/replace'; import { FolderMatch, FileMatch, FileMatchOrMatch, FolderMatchWithResource, Match, RenderableMatch, searchMatchComparer, SearchResult } from 'vs/workbench/contrib/search/common/searchModel'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; -import { ISearchConfiguration, VIEWLET_ID, PANEL_ID, ISearchConfigurationProperties } from 'vs/workbench/services/search/common/search'; +import { ISearchConfiguration, ISearchConfigurationProperties, VIEW_ID } from 'vs/workbench/services/search/common/search'; import { ISearchHistoryService } from 'vs/workbench/contrib/search/common/searchHistoryService'; -import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; -import { SearchViewPaneContainer } from 'vs/workbench/contrib/search/browser/searchViewlet'; -import { SearchPanel } from 'vs/workbench/contrib/search/browser/searchPanel'; import { ITreeNavigator } from 'vs/base/browser/ui/tree/tree'; import { createEditorFromSearchResult, openNewSearchEditor } from 'vs/workbench/contrib/search/browser/searchEditorActions'; import type { SearchEditor } from 'vs/workbench/contrib/search/browser/searchEditor'; import { SearchEditorInput } from 'vs/workbench/contrib/search/browser/searchEditorInput'; +import { IViewsService } from 'vs/workbench/common/views'; -export function isSearchViewFocused(viewletService: IViewletService, panelService: IPanelService): boolean { - const searchView = getSearchView(viewletService, panelService); +export function isSearchViewFocused(viewsService: IViewsService): boolean { + const searchView = getSearchView(viewsService); const activeElement = document.activeElement; return !!(searchView && activeElement && DOM.isAncestor(activeElement, searchView.getContainer())); } @@ -52,26 +49,12 @@ export function appendKeyBindingLabel(label: string, inputKeyBinding: number | R } } -export function openSearchView(viewletService: IViewletService, panelService: IPanelService, configurationService: IConfigurationService, focus?: boolean): Promise { - if (configurationService.getValue().search.location === 'panel') { - return Promise.resolve((panelService.openPanel(PANEL_ID, focus) as SearchPanel).getSearchView()); - } - - return viewletService.openViewlet(VIEWLET_ID, focus).then(viewlet => (viewlet?.getViewPaneContainer() as SearchViewPaneContainer).getSearchView() as SearchView); +export function openSearchView(viewsService: IViewsService, focus?: boolean): Promise { + return viewsService.openView(VIEW_ID, focus).then(view => (view as SearchView ?? undefined)); } -export function getSearchView(viewletService: IViewletService, panelService: IPanelService): SearchView | undefined { - const activeViewlet = viewletService.getActiveViewlet(); - if (activeViewlet && activeViewlet.getId() === VIEWLET_ID) { - return (activeViewlet.getViewPaneContainer() as SearchViewPaneContainer).getSearchView(); - } - - const activePanel = panelService.getActivePanel(); - if (activePanel && activePanel.getId() === PANEL_ID) { - return (activePanel as SearchPanel).getSearchView(); - } - - return undefined; +export function getSearchView(viewsService: IViewsService): SearchView | undefined { + return viewsService.getActiveViewWithId(VIEW_ID) as SearchView ?? undefined; } function doAppendKeyBindingLabel(label: string, keyBinding: ResolvedKeybinding | undefined): string { @@ -79,7 +62,7 @@ function doAppendKeyBindingLabel(label: string, keyBinding: ResolvedKeybinding | } export const toggleCaseSensitiveCommand = (accessor: ServicesAccessor) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { searchView.toggleCaseSensitive(); } @@ -94,7 +77,7 @@ export const toggleSearchEditorCaseSensitiveCommand = (accessor: ServicesAccesso }; export const toggleWholeWordCommand = (accessor: ServicesAccessor) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { searchView.toggleWholeWords(); } @@ -109,7 +92,7 @@ export const toggleSearchEditorWholeWordCommand = (accessor: ServicesAccessor) = }; export const toggleRegexCommand = (accessor: ServicesAccessor) => { - const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService)); + const searchView = getSearchView(accessor.get(IViewsService)); if (searchView) { searchView.toggleRegex(); } @@ -136,8 +119,7 @@ export class FocusNextInputAction extends Action { static readonly ID = 'search.focus.nextInputBox'; constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService, + @IViewsService private readonly viewsService: IViewsService, @IEditorService private readonly editorService: IEditorService, ) { super(id, label); @@ -150,7 +132,7 @@ export class FocusNextInputAction extends Action { (this.editorService.activeControl as SearchEditor).focusNextInput(); } - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView) { searchView.focusNextInputBox(); } @@ -162,8 +144,7 @@ export class FocusPreviousInputAction extends Action { static readonly ID = 'search.focus.previousInputBox'; constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService, + @IViewsService private readonly viewsService: IViewsService, @IEditorService private readonly editorService: IEditorService, ) { super(id, label); @@ -176,7 +157,7 @@ export class FocusPreviousInputAction extends Action { (this.editorService.activeControl as SearchEditor).focusPrevInput(); } - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView) { searchView.focusPreviousInputBox(); } @@ -185,14 +166,14 @@ export class FocusPreviousInputAction extends Action { export abstract class FindOrReplaceInFilesAction extends Action { - constructor(id: string, label: string, protected viewletService: IViewletService, protected panelService: IPanelService, protected configurationService: IConfigurationService, + constructor(id: string, label: string, protected viewsService: IViewsService, private expandSearchReplaceWidget: boolean ) { super(id, label); } run(): Promise { - return openSearchView(this.viewletService, this.panelService, this.configurationService, false).then(openedView => { + return openSearchView(this.viewsService, false).then(openedView => { if (openedView) { const searchAndReplaceWidget = openedView.searchAndReplaceWidget; searchAndReplaceWidget.toggleReplace(this.expandSearchReplaceWidget); @@ -215,10 +196,8 @@ export interface IFindInFilesArgs { } export const FindInFilesCommand: ICommandHandler = (accessor, args: IFindInFilesArgs = {}) => { - const viewletService = accessor.get(IViewletService); - const panelService = accessor.get(IPanelService); - const configurationService = accessor.get(IConfigurationService); - openSearchView(viewletService, panelService, configurationService, false).then(openedView => { + const viewsService = accessor.get(IViewsService); + openSearchView(viewsService, false).then(openedView => { if (openedView) { const searchAndReplaceWidget = openedView.searchAndReplaceWidget; searchAndReplaceWidget.toggleReplace(typeof args.replace === 'string'); @@ -238,18 +217,15 @@ export class OpenSearchViewletAction extends FindOrReplaceInFilesAction { static readonly LABEL = nls.localize('showSearch', "Show Search"); constructor(id: string, label: string, - @IViewletService viewletService: IViewletService, - @IPanelService panelService: IPanelService, - @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService, - @IConfigurationService configurationService: IConfigurationService - ) { - super(id, label, viewletService, panelService, configurationService, /*expandSearchReplaceWidget=*/false); + @IViewsService viewsService: IViewsService, + @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService) { + super(id, label, viewsService, /*expandSearchReplaceWidget=*/false); } run(): Promise { // Pass focus to viewlet if not open or focused - if (this.otherViewletShowing() || !isSearchViewFocused(this.viewletService, this.panelService)) { + if (this.otherViewletShowing() || !isSearchViewFocused(this.viewsService)) { return super.run(); } @@ -260,7 +236,7 @@ export class OpenSearchViewletAction extends FindOrReplaceInFilesAction { } private otherViewletShowing(): boolean { - return !getSearchView(this.viewletService, this.panelService); + return !getSearchView(this.viewsService); } } @@ -270,25 +246,21 @@ export class ReplaceInFilesAction extends FindOrReplaceInFilesAction { static readonly LABEL = nls.localize('replaceInFiles', "Replace in Files"); constructor(id: string, label: string, - @IViewletService viewletService: IViewletService, - @IPanelService panelService: IPanelService, - @IConfigurationService configurationService: IConfigurationService - ) { - super(id, label, viewletService, panelService, configurationService, /*expandSearchReplaceWidget=*/true); + @IViewsService viewsService: IViewsService) { + super(id, label, viewsService, /*expandSearchReplaceWidget=*/true); } } export class CloseReplaceAction extends Action { constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService + @IViewsService private readonly viewsService: IViewsService ) { super(id, label); } run(): Promise { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView) { searchView.searchAndReplaceWidget.toggleReplace(false); searchView.searchAndReplaceWidget.focus(); @@ -327,14 +299,13 @@ export class RefreshAction extends Action { static LABEL: string = nls.localize('RefreshAction.label', "Refresh"); constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService + @IViewsService private readonly viewsService: IViewsService ) { super(id, label, 'search-action codicon-refresh'); } get enabled(): boolean { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); return !!searchView && searchView.hasSearchPattern(); } @@ -343,7 +314,7 @@ export class RefreshAction extends Action { } run(): Promise { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView) { searchView.onQueryChanged(false); } @@ -358,20 +329,19 @@ export class CollapseDeepestExpandedLevelAction extends Action { static LABEL: string = nls.localize('CollapseDeepestExpandedLevelAction.label', "Collapse All"); constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService + @IViewsService private readonly viewsService: IViewsService ) { super(id, label, 'search-action codicon-collapse-all'); this.update(); } update(): void { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); this.enabled = !!searchView && searchView.hasSearchResults(); } run(): Promise { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView) { const viewer = searchView.getControl(); @@ -415,20 +385,19 @@ export class ExpandAllAction extends Action { static LABEL: string = nls.localize('ExpandAllAction.label', "Expand All"); constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService + @IViewsService private readonly viewsService: IViewsService ) { super(id, label, 'search-action codicon-expand-all'); this.update(); } update(): void { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); this.enabled = !!searchView && searchView.hasSearchResults(); } run(): Promise { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView) { const viewer = searchView.getControl(); viewer.expandAll(); @@ -449,15 +418,14 @@ export class ToggleCollapseAndExpandAction extends Action { constructor(id: string, label: string, private collapseAction: CollapseDeepestExpandedLevelAction, private expandAction: ExpandAllAction, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService + @IViewsService private readonly viewsService: IViewsService ) { super(id, label, collapseAction.class); this.update(); } update(): void { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); this.enabled = !!searchView && searchView.hasSearchResults(); this.onTreeCollapseStateChange(); } @@ -475,7 +443,7 @@ export class ToggleCollapseAndExpandAction extends Action { } private isSomeCollapsible(): boolean { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView) { const viewer = searchView.getControl(); const navigator = viewer.navigate(); @@ -501,20 +469,19 @@ export class ClearSearchResultsAction extends Action { static LABEL: string = nls.localize('ClearSearchResultsAction.label', "Clear Search Results"); constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService + @IViewsService private readonly viewsService: IViewsService ) { super(id, label, 'search-action codicon-clear-all'); this.update(); } update(): void { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); this.enabled = !!searchView && (!searchView.allSearchFieldsClear() || searchView.hasSearchResults()); } run(): Promise { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView) { searchView.clearSearchResults(); } @@ -528,20 +495,19 @@ export class CancelSearchAction extends Action { static LABEL: string = nls.localize('CancelSearchAction.label', "Cancel Search"); constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService + @IViewsService private readonly viewsService: IViewsService ) { super(id, label, 'search-action codicon-search-stop'); this.update(); } update(): void { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); this.enabled = !!searchView && searchView.isSlowSearch(); } run(): Promise { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView) { searchView.cancelSearch(); } @@ -583,8 +549,7 @@ export class OpenResultsInEditorAction extends Action { static readonly LABEL = nls.localize('search.openResultsInEditor', "Open Results in Editor"); constructor(id: string, label: string, - @IViewletService private viewletService: IViewletService, - @IPanelService private panelService: IPanelService, + @IViewsService private viewsService: IViewsService, @IConfigurationService private configurationService: IConfigurationService, @IInstantiationService private readonly instantiationService: IInstantiationService, ) { @@ -592,7 +557,7 @@ export class OpenResultsInEditorAction extends Action { } get enabled(): boolean { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); return !!searchView && searchView.hasSearchResults(); } @@ -601,7 +566,7 @@ export class OpenResultsInEditorAction extends Action { } async run() { - const searchView = getSearchView(this.viewletService, this.panelService); + const searchView = getSearchView(this.viewsService); if (searchView && this.configurationService.getValue('search').enableSearchEditorPreview) { await this.instantiationService.invokeFunction(createEditorFromSearchResult, searchView.searchResult, searchView.searchIncludePattern.getValue(), searchView.searchExcludePattern.getValue()); } @@ -614,15 +579,13 @@ export class FocusNextSearchResultAction extends Action { static readonly LABEL = nls.localize('FocusNextSearchResult.label', "Focus Next Search Result"); constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService, - @IConfigurationService private readonly configurationService: IConfigurationService + @IViewsService private readonly viewsService: IViewsService ) { super(id, label); } run(): Promise { - return openSearchView(this.viewletService, this.panelService, this.configurationService).then(searchView => { + return openSearchView(this.viewsService).then(searchView => { if (searchView) { searchView.selectNextMatch(); } @@ -635,15 +598,13 @@ export class FocusPreviousSearchResultAction extends Action { static readonly LABEL = nls.localize('FocusPreviousSearchResult.label', "Focus Previous Search Result"); constructor(id: string, label: string, - @IViewletService private readonly viewletService: IViewletService, - @IPanelService private readonly panelService: IPanelService, - @IConfigurationService private readonly configurationService: IConfigurationService + @IViewsService private readonly viewsService: IViewsService ) { super(id, label); } run(): Promise { - return openSearchView(this.viewletService, this.panelService, this.configurationService).then(searchView => { + return openSearchView(this.viewsService).then(searchView => { if (searchView) { searchView.selectPreviousMatch(); } @@ -980,12 +941,11 @@ function allFolderMatchesToString(folderMatches: Array { - const viewletService = accessor.get(IViewletService); - const panelService = accessor.get(IPanelService); + const viewsService = accessor.get(IViewsService); const clipboardService = accessor.get(IClipboardService); const labelService = accessor.get(ILabelService); - const searchView = getSearchView(viewletService, panelService); + const searchView = getSearchView(viewsService); if (searchView) { const root = searchView.searchResult; @@ -1000,10 +960,8 @@ export const clearHistoryCommand: ICommandHandler = accessor => { }; export const focusSearchListCommand: ICommandHandler = accessor => { - const viewletService = accessor.get(IViewletService); - const panelService = accessor.get(IPanelService); - const configurationService = accessor.get(IConfigurationService); - openSearchView(viewletService, panelService, configurationService).then(searchView => { + const viewsService = accessor.get(IViewsService); + openSearchView(viewsService).then(searchView => { if (searchView) { searchView.moveFocusToResults(); } diff --git a/src/vs/workbench/contrib/search/browser/searchPanel.ts b/src/vs/workbench/contrib/search/browser/searchPanel.ts deleted file mode 100644 index 559f023dee7..00000000000 --- a/src/vs/workbench/contrib/search/browser/searchPanel.ts +++ /dev/null @@ -1,70 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IStorageService } from 'vs/platform/storage/common/storage'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { PANEL_ID } from 'vs/workbench/services/search/common/search'; -import { SearchView, SearchViewPosition } from 'vs/workbench/contrib/search/browser/searchView'; -import { Panel } from 'vs/workbench/browser/panel'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { localize } from 'vs/nls'; -import * as dom from 'vs/base/browser/dom'; -import { IAction } from 'vs/base/common/actions'; - -export class SearchPanel extends Panel { - - private readonly searchView: SearchView; - - constructor( - @ITelemetryService telemetryService: ITelemetryService, - @IThemeService themeService: IThemeService, - @IStorageService storageService: IStorageService, - @IInstantiationService instantiationService: IInstantiationService, - ) { - super(PANEL_ID, telemetryService, themeService, storageService); - this.searchView = this._register(instantiationService.createInstance(SearchView, SearchViewPosition.Panel, { id: PANEL_ID, title: localize('search', "Search"), actionRunner: this.getActionRunner() })); - this._register(this.searchView.onDidChangeTitleArea(() => this.updateTitleArea())); - this._register(this.onDidChangeVisibility(visible => this.searchView.setVisible(visible))); - } - - create(parent: HTMLElement): void { - dom.addClasses(parent, 'monaco-pane-view', 'search-panel'); - this.searchView.render(); - dom.append(parent, this.searchView.element); - this.searchView.setExpanded(true); - this.searchView.headerVisible = false; - } - - public getTitle(): string { - return this.searchView.title; - } - - public layout(dimension: dom.Dimension): void { - this.searchView.width = dimension.width; - this.searchView.layout(dimension.height); - } - - public focus(): void { - this.searchView.focus(); - } - - getActions(): IAction[] { - return this.searchView.getActions(); - } - - getSecondaryActions(): IAction[] { - return this.searchView.getSecondaryActions(); - } - - saveState(): void { - this.searchView.saveState(); - super.saveState(); - } - - getSearchView(): SearchView { - return this.searchView; - } -} diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index e1b11eb5f29..2e0b61c063b 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -34,7 +34,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { TreeResourceNavigator, WorkbenchObjectTree, getSelectionKeyboardEvent } from 'vs/platform/list/browser/listService'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IProgressService, IProgressStep, IProgress } from 'vs/platform/progress/common/progress'; -import { IPatternInfo, ISearchComplete, ISearchConfiguration, ISearchConfigurationProperties, ITextQuery, VIEW_ID, VIEWLET_ID, SearchSortOrder, PANEL_ID } from 'vs/workbench/services/search/common/search'; +import { IPatternInfo, ISearchComplete, ISearchConfiguration, ISearchConfigurationProperties, ITextQuery, VIEW_ID, SearchSortOrder } from 'vs/workbench/services/search/common/search'; import { ISearchHistoryService, ISearchHistoryValues } from 'vs/workbench/contrib/search/common/searchHistoryService'; import { diffInserted, diffInsertedOutline, diffRemoved, diffRemovedOutline, editorFindMatchHighlight, editorFindMatchHighlightBorder, listActiveSelectionForeground, foreground } from 'vs/platform/theme/common/colorRegistry'; import { ICssStyleCollector, ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; @@ -63,9 +63,9 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag import { IOpenerService } from 'vs/platform/opener/common/opener'; import { MultiCursorSelectionController } from 'vs/editor/contrib/multicursor/multicursor'; import { Selection } from 'vs/editor/common/core/selection'; -import { SIDE_BAR_BACKGROUND, PANEL_BACKGROUND } from 'vs/workbench/common/theme'; import { createEditorFromSearchResult } from 'vs/workbench/contrib/search/browser/searchEditorActions'; import { Color, RGBA } from 'vs/base/common/color'; +import { IViewDescriptorService } from 'vs/workbench/common/views'; const $ = dom.$; @@ -147,7 +147,6 @@ export class SearchView extends ViewPane { private toggleCollapseStateDelayer: Delayer; constructor( - private position: SearchViewPosition, options: IViewPaneOptions, @IFileService private readonly fileService: IFileService, @IEditorService private readonly editorService: IEditorService, @@ -156,6 +155,7 @@ export class SearchView extends ViewPane { @IDialogService private readonly dialogService: IDialogService, @IContextViewService private readonly contextViewService: IContextViewService, @IInstantiationService instantiationService: IInstantiationService, + @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IConfigurationService configurationService: IConfigurationService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService, @ISearchWorkbenchService private readonly searchWorkbenchService: ISearchWorkbenchService, @@ -170,9 +170,9 @@ export class SearchView extends ViewPane { @IAccessibilityService private readonly accessibilityService: IAccessibilityService, @IKeybindingService keybindingService: IKeybindingService, @IStorageService storageService: IStorageService, - @IOpenerService private readonly openerService: IOpenerService - ) { - super({ ...options, id: VIEW_ID, ariaHeaderLabel: nls.localize('searchView', "Search") }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService); + @IOpenerService private readonly openerService: IOpenerService) { + + super({ ...options, id: VIEW_ID, ariaHeaderLabel: nls.localize('searchView', "Search") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService); this.viewletVisible = Constants.SearchViewVisibleKey.bindTo(contextKeyService); this.viewletFocused = Constants.SearchViewFocusedKey.bindTo(contextKeyService); @@ -460,7 +460,7 @@ export class SearchView extends ViewPane { this.refreshTree(); })); - this._register(this.searchWidget.onReplaceValueChanged((value) => { + this._register(this.searchWidget.onReplaceValueChanged(() => { this.viewModel.replaceString = this.searchWidget.getReplaceValue(); this.delayedRefresh.trigger(() => this.refreshTree()); })); @@ -593,7 +593,8 @@ export class SearchView extends ViewPane { let progressComplete: () => void; let progressReporter: IProgress; - this.progressService.withProgress({ location: this.position === SearchViewPosition.SideBar ? VIEWLET_ID : PANEL_ID, delay: 100, total: occurrences }, p => { + + this.progressService.withProgress({ location: this.getProgressLocation(), delay: 100, total: occurrences }, p => { progressReporter = p; return new Promise(resolve => progressComplete = resolve); @@ -724,7 +725,7 @@ export class SearchView extends ViewPane { dnd: this.instantiationService.createInstance(SearchDND), multipleSelectionSupport: false, overrideStyles: { - listBackground: this.position === SearchViewPosition.SideBar ? SIDE_BAR_BACKGROUND : PANEL_BACKGROUND + listBackground: this.getBackgroundColor() } })); this._register(this.tree.onContextMenu(e => this.onContextMenu(e))); @@ -759,7 +760,7 @@ export class SearchView extends ViewPane { } })); - this._register(this.tree.onDidBlur(e => { + this._register(this.tree.onDidBlur(() => { this.firstMatchFocused.reset(); this.fileMatchOrMatchFocused.reset(); this.fileMatchFocused.reset(); @@ -1339,13 +1340,13 @@ export class SearchView extends ViewPane { this.viewModel.cancelSearch(); this.currentSearchQ = this.currentSearchQ - .then(() => this.doSearch(query, options, excludePatternText, includePatternText, triggeredOnType)) + .then(() => this.doSearch(query, excludePatternText, includePatternText, triggeredOnType)) .then(() => undefined, () => undefined); } - private doSearch(query: ITextQuery, options: ITextQueryBuilderOptions, excludePatternText: string, includePatternText: string, triggeredOnType: boolean): Thenable { + private doSearch(query: ITextQuery, excludePatternText: string, includePatternText: string, triggeredOnType: boolean): Thenable { let progressComplete: () => void; - this.progressService.withProgress({ location: this.position === SearchViewPosition.SideBar ? VIEWLET_ID : PANEL_ID, delay: triggeredOnType ? 300 : 0 }, _progress => { + this.progressService.withProgress({ location: this.getProgressLocation(), delay: triggeredOnType ? 300 : 0 }, _progress => { return new Promise(resolve => progressComplete = resolve); }); diff --git a/src/vs/workbench/contrib/search/browser/searchWidget.ts b/src/vs/workbench/contrib/search/browser/searchWidget.ts index ad51875c1d4..df337113aa4 100644 --- a/src/vs/workbench/contrib/search/browser/searchWidget.ts +++ b/src/vs/workbench/contrib/search/browser/searchWidget.ts @@ -29,12 +29,11 @@ import { IThemeService } from 'vs/platform/theme/common/themeService'; import { ContextScopedFindInput, ContextScopedReplaceInput } from 'vs/platform/browser/contextScopedHistoryWidget'; import { appendKeyBindingLabel, isSearchViewFocused } from 'vs/workbench/contrib/search/browser/searchActions'; import * as Constants from 'vs/workbench/contrib/search/common/constants'; -import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; -import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; import { isMacintosh } from 'vs/base/common/platform'; import { Checkbox } from 'vs/base/browser/ui/checkbox/checkbox'; +import { IViewsService } from 'vs/workbench/common/views'; /** Specified in searchview.css */ export const SingleLineInputHeight = 24; @@ -677,7 +676,7 @@ export function registerContributions() { when: ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceActiveKey, CONTEXT_FIND_WIDGET_NOT_VISIBLE), primary: KeyMod.Alt | KeyMod.CtrlCmd | KeyCode.Enter, handler: accessor => { - if (isSearchViewFocused(accessor.get(IViewletService), accessor.get(IPanelService))) { + if (isSearchViewFocused(accessor.get(IViewsService))) { ReplaceAllAction.INSTANCE.run(); } } diff --git a/src/vs/workbench/contrib/search/common/constants.ts b/src/vs/workbench/contrib/search/common/constants.ts index d56b5fe5265..64ac782a467 100644 --- a/src/vs/workbench/contrib/search/common/constants.ts +++ b/src/vs/workbench/contrib/search/common/constants.ts @@ -33,8 +33,6 @@ export const ToggleSearchEditorContextLinesCommandId = 'toggleSearchEditorContex export const AddCursorsAtSearchResults = 'addCursorsAtSearchResults'; export const RevealInSideBarForSearchResults = 'search.action.revealInSideBar'; -export const ToggleSearchViewPositionCommandId = 'search.action.toggleSearchViewPosition'; - export const SearchViewVisibleKey = new RawContextKey('searchViewletVisible', true); export const SearchViewFocusedKey = new RawContextKey('searchViewletFocus', false); export const InputBoxFocusedKey = new RawContextKey('inputBoxFocus', false); diff --git a/src/vs/workbench/services/progress/test/progressIndicator.test.ts b/src/vs/workbench/services/progress/test/progressIndicator.test.ts index 2573e8938ea..79f25c0b909 100644 --- a/src/vs/workbench/services/progress/test/progressIndicator.test.ts +++ b/src/vs/workbench/services/progress/test/progressIndicator.test.ts @@ -12,8 +12,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IViewlet } from 'vs/workbench/common/viewlet'; import { TestViewletService, TestPanelService } from 'vs/workbench/test/workbenchTestServices'; import { Event } from 'vs/base/common/event'; -import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer'; -import { IView } from 'vs/workbench/common/views'; +import { IView, IViewPaneContainer } from 'vs/workbench/common/views'; class TestViewlet implements IViewlet { diff --git a/src/vs/workbench/services/views/browser/viewDescriptorService.ts b/src/vs/workbench/services/views/browser/viewDescriptorService.ts index f3f1d758418..fb1d0b4e3bd 100644 --- a/src/vs/workbench/services/views/browser/viewDescriptorService.ts +++ b/src/vs/workbench/services/views/browser/viewDescriptorService.ts @@ -337,6 +337,24 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor return this.viewsRegistry.getView(viewId); } + getViewLocation(viewId: string): ViewContainerLocation | null { + const cachedInfo = this.cachedViewInfo.get(viewId); + + if (cachedInfo && cachedInfo.location) { + return cachedInfo.location; + } + + const container = cachedInfo?.containerId ? + this.viewContainersRegistry.get(cachedInfo.containerId) ?? null : + this.viewsRegistry.getViewContainer(viewId); + + if (!container) { + return null; + } + + return this.viewContainersRegistry.getViewContainerLocation(container) ?? null; + } + getViewContainer(viewId: string): ViewContainer | null { const containerId = this.cachedViewInfo.get(viewId)?.containerId; return containerId ? @@ -528,6 +546,13 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor } private addViews(container: ViewContainer, views: IViewDescriptor[]): void { + // Update in memory cache + const location = this.viewContainersRegistry.getViewContainerLocation(container); + const sourceViewId = this.generatedContainerSourceViewIds.get(container.id); + views.forEach(view => { + this.cachedViewInfo.set(view.id, { containerId: container.id, location, sourceViewId }); + }); + this.getViewDescriptors(container).addViews(views); }