@@ -6,7 +6,7 @@ import { ICommandManager } from '../../common/application/types';
66import { Commands } from '../../common/constants' ;
77import { Common , Repl } from '../../common/utils/localize' ;
88import { IExtensionContext } from '../../common/types' ;
9- import { getGlobalStorage } from '../../common/persistentState' ;
9+ import { getGlobalStorage , getWorkspaceStateValue , updateWorkspaceStateValue } from '../../common/persistentState' ;
1010
1111export 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