forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathdebuggerDataViewerExperimentEnabler.ts
More file actions
26 lines (25 loc) · 1.29 KB
/
debuggerDataViewerExperimentEnabler.ts
File metadata and controls
26 lines (25 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { inject, injectable } from 'inversify';
import { IExtensionSingleActivationService } from '../../activation/types';
import { ICommandManager } from '../../common/application/types';
import { ContextKey } from '../../common/contextKey';
import { traceError } from '../../common/logger';
import { IExperimentService } from '../../common/types';
@injectable()
export class DebuggerDataViewerExperimentEnabler implements IExtensionSingleActivationService {
constructor(
@inject(ICommandManager) private readonly commandManager: ICommandManager,
@inject(IExperimentService) private readonly experimentService: IExperimentService
) {}
public async activate() {
this.activateInternal().catch(traceError.bind('Failed to activate debuggerDataViewerExperimentEnabler'));
}
private async activateInternal() {
// This context key controls the visibility of the 'View Variable in Data Viewer'
// context menu item from the variable window context menu during a debugging session
const isDataViewerExperimentEnabled = new ContextKey(
'python.isDebuggerDataViewerExperimentEnabled',
this.commandManager
);
await isDataViewerExperimentEnabled.set(await this.experimentService.inExperiment('debuggerDataViewer'));
}
}