@@ -108,6 +108,17 @@ export async function shellIntegrationForActiveTerminal(name: string, profile?:
108108 let hasShellIntegration = activeTerminalShellIntegration ( ) ;
109109 let timeout = 0 ;
110110
111+ // Should use onDidChangeTerminalShellIntegration event instead of polling
112+ // const result = Promise.race([
113+ // // Make sure event listener is disposed
114+ // new Promise(r => window.onDidChangeTerminalShellIntegration(() => r))),
115+ // // Note that you might not know when terminal started up, but this should be (fromNewTimeoutSetting - terminalOpened)
116+ // // It's important that the time the terminal is laucnhed is recorded and used, otherwise you might end up waiting 5s*2 if called twice
117+ // // terminalOpened = onDidOpenTerminal event time, or extension startup time (as it was already there)
118+ // timeout(fromNewTimeoutSetting)
119+ // ]);
120+ // // check result
121+ // 500ms isn't long enough
111122 while ( ! hasShellIntegration && timeout < SHELL_INTEGRATION_TIMEOUT ) {
112123 await sleep ( SHELL_INTEGRATION_POLL_INTERVAL ) ;
113124 timeout += SHELL_INTEGRATION_POLL_INTERVAL ;
@@ -134,7 +145,11 @@ export function isWsl(): boolean {
134145}
135146
136147export async function getShellIntegrationEnabledCache ( ) : Promise < boolean > {
137- const persistentState = await getGlobalPersistentState ( ) ;
148+ // Cache doesn't do anything?
149+ // const persistentState = await getGlobalPersistentState();
150+ // if (persistentState.get(SHELL_INTEGRATION_STATE_KEY)) {
151+ // return
152+ // }
138153 const shellIntegrationInspect =
139154 getConfiguration ( 'terminal.integrated' ) . inspect < boolean > ( 'shellIntegration.enabled' ) ;
140155
@@ -158,6 +173,6 @@ export async function getShellIntegrationEnabledCache(): Promise<boolean> {
158173 }
159174 }
160175
161- await persistentState . set ( SHELL_INTEGRATION_STATE_KEY , shellIntegrationEnabled ) ;
176+ // await persistentState.set(SHELL_INTEGRATION_STATE_KEY, shellIntegrationEnabled);
162177 return shellIntegrationEnabled ;
163178}
0 commit comments