Skip to content

Commit 47813a3

Browse files
committed
run and debug views can move
refs microsoft#90468
1 parent 543b36d commit 47813a3

7 files changed

Lines changed: 73 additions & 16 deletions

File tree

src/vs/platform/list/browser/listService.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,13 @@ export class WorkbenchList<T> extends List<T> {
243243

244244
readonly contextKeyService: IContextKeyService;
245245
private readonly configurationService: IConfigurationService;
246+
private readonly themeService: IThemeService;
246247

247248
private listHasSelectionOrFocus: IContextKey<boolean>;
248249
private listDoubleSelection: IContextKey<boolean>;
249250
private listMultiSelection: IContextKey<boolean>;
250251

252+
private _styler: IDisposable | undefined;
251253
private _useAltAsMultipleSelectionModifier: boolean;
252254

253255
constructor(
@@ -278,6 +280,7 @@ export class WorkbenchList<T> extends List<T> {
278280

279281
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
280282
this.configurationService = configurationService;
283+
this.themeService = themeService;
281284

282285
const listSupportsMultiSelect = WorkbenchListSupportsMultiSelectContextKey.bindTo(this.contextKeyService);
283286
listSupportsMultiSelect.set(!(options.multipleSelectionSupport === false));
@@ -292,7 +295,7 @@ export class WorkbenchList<T> extends List<T> {
292295
this.disposables.add((listService as ListService).register(this));
293296

294297
if (options.overrideStyles) {
295-
this.disposables.add(attachListStyler(this, themeService, options.overrideStyles));
298+
this.updateStyles(options.overrideStyles);
296299
}
297300

298301
this.disposables.add(this.onSelectionChange(() => {
@@ -313,6 +316,29 @@ export class WorkbenchList<T> extends List<T> {
313316
this.registerListeners();
314317
}
315318

319+
updateOptions(options: IWorkbenchListOptions<T>): void {
320+
super.updateOptions(options);
321+
322+
if (options.overrideStyles) {
323+
this.updateStyles(options.overrideStyles);
324+
}
325+
}
326+
327+
dispose(): void {
328+
super.dispose();
329+
if (this._styler) {
330+
this._styler.dispose();
331+
}
332+
}
333+
334+
private updateStyles(styles: IColorMapping): void {
335+
if (this._styler) {
336+
this._styler.dispose();
337+
}
338+
339+
this._styler = attachListStyler(this, this.themeService, styles);
340+
}
341+
316342
private registerListeners(): void {
317343
this.disposables.add(this.configurationService.onDidChangeConfiguration(e => {
318344
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
@@ -775,6 +801,14 @@ export class WorkbenchCompressibleObjectTree<T extends NonNullable<any>, TFilter
775801
this.internals = new WorkbenchTreeInternals(this, treeOptions, getAutomaticKeyboardNavigation, options.overrideStyles, contextKeyService, listService, themeService, configurationService, accessibilityService);
776802
this.disposables.add(this.internals);
777803
}
804+
805+
updateOptions(options: IWorkbenchAsyncDataTreeOptions<T, TFilterData> = {}): void {
806+
super.updateOptions(options);
807+
808+
if (options.overrideStyles) {
809+
this.internals.updateStyleOverrides(options.overrideStyles);
810+
}
811+
}
778812
}
779813

780814
export interface IWorkbenchDataTreeOptions<T, TFilterData> extends IDataTreeOptions<T, TFilterData> {

src/vs/workbench/contrib/debug/browser/breakpointsView.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/
3131
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
3232
import { ILabelService } from 'vs/platform/label/common/label';
3333
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
34-
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
3534
import { Gesture } from 'vs/base/browser/touch';
3635
import { IViewDescriptorService } from 'vs/workbench/common/views';
3736
import { TextEditorSelectionRevealType } from 'vs/platform/editor/common/editor';
@@ -102,7 +101,7 @@ export class BreakpointsView extends ViewPane {
102101
isChecked: (breakpoint: IEnablement) => breakpoint.enabled
103102
},
104103
overrideStyles: {
105-
listBackground: SIDE_BAR_BACKGROUND
104+
listBackground: this.getBackgroundColor()
106105
}
107106
});
108107

@@ -154,6 +153,12 @@ export class BreakpointsView extends ViewPane {
154153
this.onBreakpointsChange();
155154
}
156155
}));
156+
157+
this._register(this.viewDescriptorService.onDidChangeLocation(({ views, from, to }) => {
158+
if (views.some(v => v.id === this.id)) {
159+
this.list.updateOptions({ overrideStyles: { listBackground: this.getBackgroundColor() } });
160+
}
161+
}));
157162
}
158163

159164
public focus(): void {

src/vs/workbench/contrib/debug/browser/callStackView.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import { isSessionAttach } from 'vs/workbench/contrib/debug/common/debugUtils';
3434
import { STOP_ID, STOP_LABEL, DISCONNECT_ID, DISCONNECT_LABEL, RESTART_SESSION_ID, RESTART_LABEL, STEP_OVER_ID, STEP_OVER_LABEL, STEP_INTO_LABEL, STEP_INTO_ID, STEP_OUT_LABEL, STEP_OUT_ID, PAUSE_ID, PAUSE_LABEL, CONTINUE_ID, CONTINUE_LABEL } from 'vs/workbench/contrib/debug/browser/debugCommands';
3535
import { ICommandService } from 'vs/platform/commands/common/commands';
3636
import { CollapseAction } from 'vs/workbench/browser/viewlet';
37-
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
3837
import { IViewDescriptorService } from 'vs/workbench/common/views';
3938
import { IThemeService } from 'vs/platform/theme/common/themeService';
4039
import { IOpenerService } from 'vs/platform/opener/common/opener';
@@ -203,7 +202,7 @@ export class CallStackView extends ViewPane {
203202
},
204203
expandOnlyOnTwistieClick: true,
205204
overrideStyles: {
206-
listBackground: SIDE_BAR_BACKGROUND
205+
listBackground: this.getBackgroundColor()
207206
}
208207
});
209208

@@ -296,6 +295,12 @@ export class CallStackView extends ViewPane {
296295
this.parentSessionToExpand.add(s.parentSession);
297296
}
298297
}));
298+
299+
this._register(this.viewDescriptorService.onDidChangeLocation(({ views, from, to }) => {
300+
if (views.some(v => v.id === this.id)) {
301+
this.tree.updateOptions({ overrideStyles: { listBackground: this.getBackgroundColor() } });
302+
}
303+
}));
299304
}
300305

301306
layoutBody(height: number, width: number): void {

src/vs/workbench/contrib/debug/browser/debug.contribution.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ Registry.as<IViewsRegistry>(ViewExtensions.ViewsRegistry).registerViews([{
104104

105105
// Register default debug views
106106
const viewsRegistry = Registry.as<IViewsRegistry>(ViewExtensions.ViewsRegistry);
107-
viewsRegistry.registerViews([{ id: VARIABLES_VIEW_ID, name: nls.localize('variables', "Variables"), ctorDescriptor: new SyncDescriptor(VariablesView), order: 10, weight: 40, canToggleVisibility: true, focusCommand: { id: 'workbench.debug.action.focusVariablesView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer);
108-
viewsRegistry.registerViews([{ id: WATCH_VIEW_ID, name: nls.localize('watch', "Watch"), ctorDescriptor: new SyncDescriptor(WatchExpressionsView), order: 20, weight: 10, canToggleVisibility: true, focusCommand: { id: 'workbench.debug.action.focusWatchView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer);
109-
viewsRegistry.registerViews([{ id: CALLSTACK_VIEW_ID, name: nls.localize('callStack', "Call Stack"), ctorDescriptor: new SyncDescriptor(CallStackView), order: 30, weight: 30, canToggleVisibility: true, focusCommand: { id: 'workbench.debug.action.focusCallStackView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer);
110-
viewsRegistry.registerViews([{ id: BREAKPOINTS_VIEW_ID, name: nls.localize('breakpoints', "Breakpoints"), ctorDescriptor: new SyncDescriptor(BreakpointsView), order: 40, weight: 20, canToggleVisibility: true, focusCommand: { id: 'workbench.debug.action.focusBreakpointsView' }, when: ContextKeyExpr.or(CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer);
107+
viewsRegistry.registerViews([{ id: VARIABLES_VIEW_ID, name: nls.localize('variables', "Variables"), ctorDescriptor: new SyncDescriptor(VariablesView), order: 10, weight: 40, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusVariablesView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer);
108+
viewsRegistry.registerViews([{ id: WATCH_VIEW_ID, name: nls.localize('watch', "Watch"), ctorDescriptor: new SyncDescriptor(WatchExpressionsView), order: 20, weight: 10, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusWatchView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer);
109+
viewsRegistry.registerViews([{ id: CALLSTACK_VIEW_ID, name: nls.localize('callStack', "Call Stack"), ctorDescriptor: new SyncDescriptor(CallStackView), order: 30, weight: 30, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusCallStackView' }, when: CONTEXT_DEBUG_UX.isEqualTo('default') }], viewContainer);
110+
viewsRegistry.registerViews([{ id: BREAKPOINTS_VIEW_ID, name: nls.localize('breakpoints', "Breakpoints"), ctorDescriptor: new SyncDescriptor(BreakpointsView), order: 40, weight: 20, canToggleVisibility: true, canMoveView: true, focusCommand: { id: 'workbench.debug.action.focusBreakpointsView' }, when: ContextKeyExpr.or(CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer);
111111
viewsRegistry.registerViews([{ id: StartView.ID, name: StartView.LABEL, ctorDescriptor: new SyncDescriptor(StartView), order: 10, weight: 40, canToggleVisibility: true, when: CONTEXT_DEBUG_UX.isEqualTo('simple') }], viewContainer);
112-
viewsRegistry.registerViews([{ id: LOADED_SCRIPTS_VIEW_ID, name: nls.localize('loadedScripts', "Loaded Scripts"), ctorDescriptor: new SyncDescriptor(LoadedScriptsView), order: 35, weight: 5, canToggleVisibility: true, collapsed: true, when: ContextKeyExpr.and(CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer);
112+
viewsRegistry.registerViews([{ id: LOADED_SCRIPTS_VIEW_ID, name: nls.localize('loadedScripts', "Loaded Scripts"), ctorDescriptor: new SyncDescriptor(LoadedScriptsView), order: 35, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: ContextKeyExpr.and(CONTEXT_LOADED_SCRIPTS_SUPPORTED, CONTEXT_DEBUG_UX.isEqualTo('default')) }], viewContainer);
113113

114114
registerCommands();
115115

src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import { dispose } from 'vs/base/common/lifecycle';
3434
import { createMatches, FuzzyScore } from 'vs/base/common/filters';
3535
import { DebugContentProvider } from 'vs/workbench/contrib/debug/common/debugContentProvider';
3636
import { ILabelService } from 'vs/platform/label/common/label';
37-
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
3837
import type { ICompressedTreeNode } from 'vs/base/browser/ui/tree/compressedObjectTreeModel';
3938
import type { ICompressibleTreeRenderer } from 'vs/base/browser/ui/tree/objectTree';
4039
import { IViewDescriptorService } from 'vs/workbench/common/views';
@@ -472,7 +471,7 @@ export class LoadedScriptsView extends ViewPane {
472471
accessibilityProvider: new LoadedSciptsAccessibilityProvider(),
473472
ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'loadedScriptsAriaLabel' }, "Debug Loaded Scripts"),
474473
overrideStyles: {
475-
listBackground: SIDE_BAR_BACKGROUND
474+
listBackground: this.getBackgroundColor()
476475
}
477476
}
478477
);
@@ -574,6 +573,12 @@ export class LoadedScriptsView extends ViewPane {
574573
}
575574
}));
576575

576+
this._register(this.viewDescriptorService.onDidChangeLocation(({ views, from, to }) => {
577+
if (views.some(v => v.id === this.id)) {
578+
this.tree.updateOptions({ overrideStyles: { listBackground: this.getBackgroundColor() } });
579+
}
580+
}));
581+
577582
// feature: expand all nodes when filtering (not when finding)
578583
let viewState: IViewState | undefined;
579584
this._register(this.tree.onDidChangeTypeFilterPattern(pattern => {

src/vs/workbench/contrib/debug/browser/variablesView.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { HighlightedLabel, IHighlight } from 'vs/base/browser/ui/highlightedlabe
3030
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
3131
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
3232
import { dispose } from 'vs/base/common/lifecycle';
33-
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
3433
import { IViewDescriptorService } from 'vs/workbench/common/views';
3534
import { IOpenerService } from 'vs/platform/opener/common/opener';
3635
import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -102,7 +101,7 @@ export class VariablesView extends ViewPane {
102101
identityProvider: { getId: (element: IExpression | IScope) => element.getId() },
103102
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: IExpression | IScope) => e },
104103
overrideStyles: {
105-
listBackground: SIDE_BAR_BACKGROUND
104+
listBackground: this.getBackgroundColor()
106105
}
107106
});
108107

@@ -148,6 +147,11 @@ export class VariablesView extends ViewPane {
148147
this.tree.rerender(e);
149148
}
150149
}));
150+
this._register(this.viewDescriptorService.onDidChangeLocation(({ views, from, to }) => {
151+
if (views.some(v => v.id === this.id)) {
152+
this.tree.updateOptions({ overrideStyles: { listBackground: this.getBackgroundColor() } });
153+
}
154+
}));
151155
}
152156

153157
layoutBody(width: number, height: number): void {

src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { IHighlight } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel
3030
import { variableSetEmitter, VariablesRenderer } from 'vs/workbench/contrib/debug/browser/variablesView';
3131
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
3232
import { dispose } from 'vs/base/common/lifecycle';
33-
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
3433
import { IViewDescriptorService } from 'vs/workbench/common/views';
3534
import { IOpenerService } from 'vs/platform/opener/common/opener';
3635
import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -89,7 +88,7 @@ export class WatchExpressionsView extends ViewPane {
8988
},
9089
dnd: new WatchExpressionsDragAndDrop(this.debugService),
9190
overrideStyles: {
92-
listBackground: SIDE_BAR_BACKGROUND
91+
listBackground: this.getBackgroundColor()
9392
}
9493
});
9594

@@ -146,6 +145,11 @@ export class WatchExpressionsView extends ViewPane {
146145
this.tree.rerender(e);
147146
}
148147
}));
148+
this._register(this.viewDescriptorService.onDidChangeLocation(({ views, from, to }) => {
149+
if (views.some(v => v.id === this.id)) {
150+
this.tree.updateOptions({ overrideStyles: { listBackground: this.getBackgroundColor() } });
151+
}
152+
}));
149153
}
150154

151155
layoutBody(height: number, width: number): void {

0 commit comments

Comments
 (0)