Skip to content

Commit c225f6a

Browse files
committed
add workspace level too
1 parent 09c6052 commit c225f6a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/client/terminals/codeExecution/terminalReplWatcher.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ICommandManager } from '../../common/application/types';
66
import { Commands } from '../../common/constants';
77
import { Common, Repl } from '../../common/utils/localize';
88
import { IExtensionContext } from '../../common/types';
9-
import { getGlobalStorage } from '../../common/persistentState';
9+
import { getGlobalStorage, getWorkspaceStateValue, updateWorkspaceStateValue } from '../../common/persistentState';
1010

1111
export const SUGGEST_NATIVE_REPL = 'suggestNativeRepl';
1212

@@ -20,6 +20,8 @@ export async function registerTriggerForTerminalREPL(
2020
context: IExtensionContext,
2121
disposables: Disposable[],
2222
): Promise<void> {
23+
// When extension reloads via user triggering reloading of VS Code, reset to suggest Native REPL on workspace level.
24+
await updateWorkspaceStateValue(SUGGEST_NATIVE_REPL, true);
2325
disposables.push(
2426
onDidStartTerminalShellExecution(async (e: TerminalShellExecutionStartEvent) => {
2527
if (e.execution.commandLine.isTrusted && checkREPLCommand(e.execution.commandLine.value)) {
@@ -28,8 +30,9 @@ export async function registerTriggerForTerminalREPL(
2830
// Plan:
2931
// Global memento to disable show of prompt entirely - global memento
3032
// workspace memento to track and only show suggest of native REPL once.
31-
const globalSuggestNativeRepl = getGlobalStorage<boolean>(context, SUGGEST_NATIVE_REPL);
32-
if (globalSuggestNativeRepl.get()) {
33+
const globalSuggestNativeRepl = getGlobalStorage<boolean>(context, SUGGEST_NATIVE_REPL, true);
34+
const workspaceSuggestNativeRepl = getWorkspaceStateValue<boolean>(SUGGEST_NATIVE_REPL, true);
35+
if (globalSuggestNativeRepl.get() && workspaceSuggestNativeRepl) {
3336
// Prompt user to start Native REPL
3437
const selection = await showWarningMessage(
3538
Repl.terminalSuggestNativeReplPrompt,
@@ -44,6 +47,8 @@ export async function registerTriggerForTerminalREPL(
4447
await globalSuggestNativeRepl.set(false);
4548
}
4649
}
50+
// Update workspace native repl suggestion value after the first 'python' in terminal.
51+
await updateWorkspaceStateValue(SUGGEST_NATIVE_REPL, false);
4752
}
4853
}),
4954
);

0 commit comments

Comments
 (0)