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

Adds Don't ask Again button for Shell Warning #1681

Merged
merged 1 commit into from
Sep 23, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@ export enum TELEMETRY_EVENTS {
RecommendExtension = 'runme.recommendExtension',
NotebookGist = 'runme.notebookGist',
CellGist = 'runme.cellGist',
ShellWarning = 'extension.shellWarning',
}

export enum WebViews {
Expand Down
13 changes: 10 additions & 3 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -347,21 +347,28 @@ export class RunmeExtension {

await bootFile(context)

if (kernel.hasExperimentEnabled('shellWarning', false)) {
if (
kernel.hasExperimentEnabled('shellWarning', false) &&
context.globalState.get<boolean>(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)
}
}

Expand Down