Skip to content

Commit a3e81c9

Browse files
authored
Base off release branch
1 parent 2971ac5 commit a3e81c9

6 files changed

Lines changed: 41 additions & 8 deletions

File tree

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,7 @@
16701670
{
16711671
"command": "python.datascience.showDataViewer",
16721672
"group": "1_view",
1673-
"when": "debugProtocolVariableMenuContext == 'viewableInDataViewer'"
1673+
"when": "python.isDebuggerDataViewerExperimentEnabled && debugProtocolVariableMenuContext == 'viewableInDataViewer'"
16741674
}
16751675
]
16761676
},
@@ -2127,6 +2127,7 @@
21272127
"RunByLine - experiment",
21282128
"tryPylance",
21292129
"jediLSP",
2130+
"debuggerDataViewer",
21302131
"All"
21312132
]
21322133
},
@@ -2152,6 +2153,7 @@
21522153
"RunByLine - experiment",
21532154
"tryPylance",
21542155
"jediLSP",
2156+
"debuggerDataViewer",
21552157
"All"
21562158
]
21572159
},

src/client/common/serviceRegistry.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33
import { IExtensionSingleActivationService } from '../activation/types';
44
import { IExperimentService, IFileDownloader, IHttpClient, IInterpreterPathService } from '../common/types';
5+
import { DebuggerDataViewerExperimentEnabler } from '../datascience/data-viewing/debuggerDataViewerExperimentEnabler';
56
import { LiveShareApi } from '../datascience/liveshare/liveshare';
67
import { INotebookExecutionLogger } from '../datascience/types';
78
import { IServiceManager } from '../ioc/types';
@@ -218,5 +219,9 @@ export function registerTypes(serviceManager: IServiceManager) {
218219
IExtensionSingleActivationService,
219220
DebugSessionTelemetry
220221
);
222+
serviceManager.addSingleton<IExtensionSingleActivationService>(
223+
IExtensionSingleActivationService,
224+
DebuggerDataViewerExperimentEnabler
225+
);
221226
serviceManager.addSingleton<ICustomEditorService>(ICustomEditorService, CustomEditorService);
222227
}

src/client/datascience/constants.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,7 @@ export enum Telemetry {
410410
TrustAllNotebooks = 'DATASCIENCE.TRUST_ALL_NOTEBOOKS',
411411
TrustNotebook = 'DATASCIENCE.TRUST_NOTEBOOK',
412412
DoNotTrustNotebook = 'DATASCIENCE.DO_NOT_TRUST_NOTEBOOK',
413-
NotebookTrustPromptShown = 'DATASCIENCE.NOTEBOOK_TRUST_PROMPT_SHOWN',
414-
OpenDataViewerFromVariableWindowRequest = 'DATASCIENCE.OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_REQUEST',
415-
OpenDataViewerFromVariableWindowError = 'DATASCIENCE.OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_ERROR',
416-
OpenDataViewerFromVariableWindowSuccess = 'DATASCIENCE.OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_SUCCESS'
413+
NotebookTrustPromptShown = 'DATASCIENCE.NOTEBOOK_TRUST_PROMPT_SHOWN'
417414
}
418415

419416
export enum NativeKeyboardCommandTelemetry {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { inject, injectable } from 'inversify';
2+
import { IExtensionSingleActivationService } from '../../activation/types';
3+
import { ICommandManager } from '../../common/application/types';
4+
import { ContextKey } from '../../common/contextKey';
5+
import { traceError } from '../../common/logger';
6+
import { IExperimentService } from '../../common/types';
7+
8+
@injectable()
9+
export class DebuggerDataViewerExperimentEnabler implements IExtensionSingleActivationService {
10+
constructor(
11+
@inject(ICommandManager) private readonly commandManager: ICommandManager,
12+
@inject(IExperimentService) private readonly experimentService: IExperimentService
13+
) {}
14+
public async activate() {
15+
this.activateInternal().catch(traceError.bind('Failed to activate debuggerDataViewerExperimentEnabler'));
16+
}
17+
private async activateInternal() {
18+
// This context key controls the visibility of the 'View Variable in Data Viewer'
19+
// context menu item from the variable window context menu during a debugging session
20+
const isDataViewerExperimentEnabled = new ContextKey(
21+
'python.isDebuggerDataViewerExperimentEnabled',
22+
this.commandManager
23+
);
24+
await isDataViewerExperimentEnabled.set(await this.experimentService.inExperiment('debuggerDataViewer'));
25+
}
26+
}

src/client/telemetry/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export enum EventName {
5555
DEBUGGER_ATTACH_TO_LOCAL_PROCESS = 'DEBUGGER.ATTACH_TO_LOCAL_PROCESS',
5656
DEBUGGER_CONFIGURATION_PROMPTS = 'DEBUGGER.CONFIGURATION.PROMPTS',
5757
DEBUGGER_CONFIGURATION_PROMPTS_IN_LAUNCH_JSON = 'DEBUGGER.CONFIGURATION.PROMPTS.IN.LAUNCH.JSON',
58+
OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_REQUEST = 'OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_REQUEST',
59+
OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_ERROR = 'OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_ERROR',
60+
OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_SUCCESS = 'OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_SUCCESS',
5861
UNITTEST_STOP = 'UNITTEST.STOP',
5962
UNITTEST_DISABLE = 'UNITTEST.DISABLE',
6063
UNITTEST_RUN = 'UNITTEST.RUN',

src/client/telemetry/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,9 @@ export interface IEventNamePropertyMapping {
587587
*/
588588
manuallyEnteredAValue?: boolean;
589589
};
590+
[EventName.OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_REQUEST]: never | undefined;
591+
[EventName.OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_ERROR]: never | undefined;
592+
[EventName.OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_SUCCESS]: never | undefined;
590593
/**
591594
* Telemetry event sent when providing completion provider in launch.json. It is sent just *after* inserting the completion.
592595
*/
@@ -1772,9 +1775,6 @@ export interface IEventNamePropertyMapping {
17721775
[Telemetry.SetJupyterURIToUserSpecified]: never | undefined;
17731776
[Telemetry.ShiftEnterBannerShown]: never | undefined;
17741777
[Telemetry.ShowDataViewer]: { rows: number | undefined; columns: number | undefined };
1775-
[Telemetry.OpenDataViewerFromVariableWindowRequest]: never | undefined;
1776-
[Telemetry.OpenDataViewerFromVariableWindowError]: never | undefined;
1777-
[Telemetry.OpenDataViewerFromVariableWindowSuccess]: never | undefined;
17781778
[Telemetry.CreateNewInteractive]: never | undefined;
17791779
[Telemetry.StartJupyter]: never | undefined;
17801780
[Telemetry.StartJupyterProcess]: never | undefined;

0 commit comments

Comments
 (0)