diff --git a/package.json b/package.json index ab485bc79..8dbcb6f15 100644 --- a/package.json +++ b/package.json @@ -644,7 +644,7 @@ "runme.experiments.shellWarning": { "type": "boolean", "scope": "window", - "default": false, + "default": true, "markdownDescription": "If set to `true`, the extension will display an error message if an unsupported shell is detected." }, "runme.experiments.reporter": { diff --git a/src/constants.ts b/src/constants.ts index 19c94f279..f48749734 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1101,6 +1101,7 @@ export enum TELEMETRY_EVENTS { RecommendExtension = 'runme.recommendExtension', NotebookGist = 'runme.notebookGist', CellGist = 'runme.cellGist', + ShellWarning = 'extension.shellWarning', } export enum WebViews { diff --git a/src/extension/extension.ts b/src/extension/extension.ts index 2d151ff5d..9c92a24cc 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -21,7 +21,7 @@ import { getRunmeAppUrl, getSessionOutputs, } from '../utils/configuration' -import { AuthenticationProviders, WebViews } from '../constants' +import { AuthenticationProviders, TELEMETRY_EVENTS, WebViews } from '../constants' import { Kernel } from './kernel' import KernelServer from './server/kernelServer' @@ -347,21 +347,28 @@ export class RunmeExtension { await bootFile(context) - if (kernel.hasExperimentEnabled('shellWarning', false)) { + if ( + kernel.hasExperimentEnabled('shellWarning', false) && + context.globalState.get(TELEMETRY_EVENTS.ShellWarning, true) + ) { const showUnsupportedShellMessage = async () => { const learnMore = 'Learn more' + const dontAskAgain = "Don't ask again" - TelemetryReporter.sendTelemetryEvent('extension.shellWarning') + TelemetryReporter.sendTelemetryEvent(TELEMETRY_EVENTS.ShellWarning) const answer = await window.showWarningMessage( 'Your current shell has limited or no support.' + ' Please consider switching to sh, bash, or zsh.' + ' Click "Learn more" for additional resources.', learnMore, + dontAskAgain, ) if (answer === learnMore) { const url = getDocsUrlFor('/r/extension/unsupported-shell') env.openExternal(Uri.parse(url)) + } else if (answer === dontAskAgain) { + await context.globalState.update(TELEMETRY_EVENTS.ShellWarning, false) } }