Skip to content

Commit 75da3d5

Browse files
authored
testing: fix setting of testing.isInPeek context key (microsoft#187066)
Fixes microsoft#186979
1 parent e19f1af commit 75da3d5

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,13 +711,10 @@ class TestResultsViewContent extends Disposable {
711711
historyVisible: IObservableValue<boolean>;
712712
showRevealLocationOnMessages: boolean;
713713
},
714-
@IContextKeyService contextKeyService: IContextKeyService,
715714
@IInstantiationService private readonly instantiationService: IInstantiationService,
716715
@ITextModelService protected readonly modelService: ITextModelService,
717716
) {
718717
super();
719-
720-
TestingContextKeys.isInPeek.bindTo(contextKeyService);
721718
}
722719

723720
public fillBody(containerElement: HTMLElement): void {
@@ -806,6 +803,7 @@ class TestResultsPeek extends PeekViewWidget {
806803

807804
private readonly visibilityChange = this._disposables.add(new Emitter<boolean>());
808805
private readonly content: TestResultsViewContent;
806+
private scopedContextKeyService?: IContextKeyService;
809807
private dimension?: dom.Dimension;
810808
public current?: InspectSubject;
811809

@@ -821,7 +819,6 @@ class TestResultsPeek extends PeekViewWidget {
821819
) {
822820
super(editor, { showFrame: true, frameWidth: 1, showArrow: true, isResizeable: true, isAccessible: true, className: 'test-output-peek' }, instantiationService);
823821

824-
TestingContextKeys.isInPeek.bindTo(contextKeyService);
825822
this._disposables.add(themeService.onDidColorThemeChange(this.applyTheme, this));
826823
this._disposables.add(this.onDidClose(() => this.visibilityChange.fire(false)));
827824
this.content = this._disposables.add(instantiationService.createInstance(TestResultsViewContent, editor, { historyVisible: testingPeek.historyVisible, showRevealLocationOnMessages: false }));
@@ -841,6 +838,15 @@ class TestResultsPeek extends PeekViewWidget {
841838
});
842839
}
843840

841+
protected override _fillContainer(container: HTMLElement): void {
842+
if (!this.scopedContextKeyService) {
843+
this.scopedContextKeyService = this._disposables.add(this.contextKeyService.createScoped(container));
844+
TestingContextKeys.isInPeek.bindTo(this.scopedContextKeyService).set(true);
845+
}
846+
847+
super._fillContainer(container);
848+
}
849+
844850
protected override _fillHead(container: HTMLElement): void {
845851
super._fillHead(container);
846852

src/vs/workbench/contrib/testing/common/testingContextKeys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export namespace TestingContextKeys {
3535
export const viewMode = new RawContextKey<TestExplorerViewMode>('testing.explorerViewMode', TestExplorerViewMode.List);
3636
export const viewSorting = new RawContextKey<TestExplorerViewSorting>('testing.explorerViewSorting', TestExplorerViewSorting.ByLocation);
3737
export const isRunning = new RawContextKey<boolean>('testing.isRunning', false);
38-
export const isInPeek = new RawContextKey<boolean>('testing.isInPeek', true);
38+
export const isInPeek = new RawContextKey<boolean>('testing.isInPeek', false);
3939
export const isPeekVisible = new RawContextKey<boolean>('testing.isPeekVisible', false);
4040

4141
export const peekItemType = new RawContextKey<string | undefined>('peekItemType', undefined, {

0 commit comments

Comments
 (0)