Skip to content

Commit

Permalink
fix: peek view context key scoped (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricbet authored Feb 23, 2022
1 parent 9e7f2ec commit 43a8d47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class TestOutputPeekContribution implements IEditorFeatureContribution {
private currentPeekUri: URI | undefined;

constructor(@Optional() private readonly editor: IEditor) {
this.testContextKey = this.injector.get(TestContextKey, [this.editor.monacoEditor.getContainerDomNode()]);
this.testContextKey = this.injector.get(TestContextKey, [(this.editor.monacoEditor as any)._contextKeyService]);
}

private allMessages(results: readonly ITestResult[]): {
Expand Down
4 changes: 3 additions & 1 deletion packages/testing/src/browser/test-contextkey.service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { IContextKeyServiceTarget } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
import { ContextKeyService } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService';
import { Optional, Injectable, Autowired } from '@opensumi/di';
import { IContextKeyService, IContextKey, IScopedContextKeyService } from '@opensumi/ide-core-browser';
import { TestingIsPeekVisible } from '@opensumi/ide-core-browser/lib/contextkey/testing';
Expand All @@ -11,7 +13,7 @@ export class TestContextKey {

public readonly contextTestingIsPeekVisible: IContextKey<boolean>;

constructor(@Optional() dom?: HTMLElement) {
constructor(@Optional() dom?: HTMLElement | IContextKeyServiceTarget | ContextKeyService) {
this._contextKeyService = this.globalContextKeyService.createScoped(dom);
this.contextTestingIsPeekVisible = TestingIsPeekVisible.bind(this.contextKeyScoped);
}
Expand Down

0 comments on commit 43a8d47

Please sign in to comment.