Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup experiment for deprecation. #15418

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/platform/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ export interface IAsyncDisposableRegistry extends IAsyncDisposable {
export enum Experiments {
DataViewerContribution = 'DataViewerContribution',
KernelCompletions = 'KernelCompletions',
DoNotWaitForZmqPortsToBeUsed = 'DoNotWaitForZmqPortsToBeUsed'
DoNotWaitForZmqPortsToBeUsed = 'DoNotWaitForZmqPortsToBeUsed',
DataViewerDeprecation = 'DataViewerDeprecation'
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/platform/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,10 @@ export namespace DataScience {
export const failedToFetchKernelSpecsRemoteErrorMessageForQuickPickDetail = l10n.t(
'Ensure the server is running and reachable.'
);
export const dataViewerDeprecationMessage = l10n.t(
'The Data Viewer will be deprecated in coming months. Please install other data viewing extensions.'
);
export const dataViewerDeprecationRecommendationActionMessage = l10n.t('See Recommended Extensions.');
}
export namespace WebViews {
export const collapseSingle = l10n.t('Collapse');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import { inject, injectable, named, optional } from 'inversify';
import { DebugConfiguration, Uri, commands, window, workspace } from 'vscode';
import { DebugConfiguration, Memento, Uri, commands, window, workspace } from 'vscode';
import { DebugProtocol } from 'vscode-debugprotocol';
import { convertDebugProtocolVariableToIJupyterVariable } from '../../../kernels/variables/helpers';
import { IJupyterVariable, IJupyterVariables } from '../../../kernels/variables/types';
Expand All @@ -11,7 +11,14 @@ import { ICommandNameArgumentTypeMapping } from '../../../commands';
import { IDebugService } from '../../../platform/common/application/types';
import { Commands, Identifiers, JupyterNotebookView, Telemetry } from '../../../platform/common/constants';
import { IPlatformService } from '../../../platform/common/platform/types';
import { IConfigurationService, IDisposableRegistry } from '../../../platform/common/types';
import {
Experiments,
GLOBAL_MEMENTO,
IConfigurationService,
IDisposableRegistry,
IExperimentService,
IMemento
} from '../../../platform/common/types';
import { DataScience } from '../../../platform/common/utils/localize';
import { noop } from '../../../platform/common/utils/misc';
import { untildify } from '../../../platform/common/utils/platform';
Expand All @@ -27,6 +34,8 @@ import { IKernelProvider } from '../../../kernels/types';
import { IInteractiveWindowProvider } from '../../../interactive-window/types';
import { IShowDataViewerFromVariablePanel } from '../../../messageTypes';

export const PromptAboutDeprecation = 'ds_prompt_about_deprecation';

@injectable()
export class DataViewerCommandRegistry implements IExtensionSyncActivationService {
private dataViewerChecker: DataViewerChecker;
Expand All @@ -49,7 +58,9 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic
@inject(IInterpreterService) @optional() private readonly interpreterService: IInterpreterService | undefined,
@inject(IPlatformService) private readonly platformService: IPlatformService,
@inject(IKernelProvider) private readonly kernelProvider: IKernelProvider,
@inject(IInteractiveWindowProvider) private interactiveWindowProvider: IInteractiveWindowProvider
@inject(IInteractiveWindowProvider) private interactiveWindowProvider: IInteractiveWindowProvider,
@inject(IExperimentService) private readonly experimentService: IExperimentService,
@inject(IMemento) @named(GLOBAL_MEMENTO) private readonly globalMemento: Memento
) {
this.dataViewerChecker = new DataViewerChecker(configService);
if (!workspace.isTrusted) {
Expand All @@ -76,6 +87,26 @@ export class DataViewerCommandRegistry implements IExtensionSyncActivationServic
private async onVariablePanelShowDataViewerRequest(request: IJupyterVariable | IShowDataViewerFromVariablePanel) {
const requestVariable = 'variable' in request ? request.variable : request;
sendTelemetryEvent(EventName.OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_REQUEST);

// DataViewerDeprecation
const deprecateDataViewer = this.experimentService.inExperiment(Experiments.DataViewerDeprecation);
if (!this.globalMemento.get(PromptAboutDeprecation) && deprecateDataViewer) {
this.globalMemento.update(PromptAboutDeprecation, true).then(noop, noop);

window
.showInformationMessage(
DataScience.dataViewerDeprecationMessage,
DataScience.dataViewerDeprecationRecommendationActionMessage
)
.then((action) => {
if (action === DataScience.dataViewerDeprecationRecommendationActionMessage) {
commands
.executeCommand('workbench.extensions.search', '@tag:jupyterVariableViewers')
.then(noop, noop);
}
}, noop);
}

if (
this.debugService?.activeDebugSession &&
this.variableProvider &&
Expand Down
Loading