@@ -114,16 +114,6 @@ class NativePythonFinderImpl extends DisposableBase implements NativePythonFinde
114114
115115 private readonly suppressErrorNotification : IPersistentStorage < boolean > ;
116116
117- /**
118- * Tracks whether the internal JSON-RPC connection has been closed.
119- * This can happen independently of the finder being disposed.
120- */
121- private _connectionClosed = false ;
122-
123- public get isConnectionClosed ( ) : boolean {
124- return this . _connectionClosed ;
125- }
126-
127117 constructor ( private readonly cacheDirectory ?: Uri , private readonly context ?: IExtensionContext ) {
128118 super ( ) ;
129119 this . suppressErrorNotification = this . context
@@ -145,21 +135,14 @@ class NativePythonFinderImpl extends DisposableBase implements NativePythonFinde
145135 }
146136
147137 async * refresh ( options ?: NativePythonEnvironmentKind | Uri [ ] ) : AsyncIterable < NativeEnvInfo > {
148- this . outputChannel . info (
149- `refresh() called: firstRefreshResults=${ ! ! this . firstRefreshResults } , connectionClosed=${
150- this . _connectionClosed
151- } , isDisposed=${ this . isDisposed } `,
152- ) ;
153138 if ( this . firstRefreshResults ) {
154139 // If this is the first time we are refreshing,
155140 // Then get the results from the first refresh.
156141 // Those would have started earlier and cached in memory.
157- this . outputChannel . info ( 'Using firstRefreshResults' ) ;
158142 const results = this . firstRefreshResults ( ) ;
159143 this . firstRefreshResults = undefined ;
160144 yield * results ;
161145 } else {
162- this . outputChannel . info ( 'Calling doRefresh' ) ;
163146 const result = this . doRefresh ( options ) ;
164147 let completed = false ;
165148 void result . completed . finally ( ( ) => {
@@ -315,8 +298,6 @@ class NativePythonFinderImpl extends DisposableBase implements NativePythonFinde
315298 sendNativeTelemetry ( data , this . initialRefreshMetrics ) ,
316299 ) ,
317300 connection . onClose ( ( ) => {
318- this . outputChannel . info ( 'JSON-RPC connection closed, marking connection as closed' ) ;
319- this . _connectionClosed = true ;
320301 disposables . forEach ( ( d ) => d . dispose ( ) ) ;
321302 } ) ,
322303 ) ;
@@ -540,9 +521,6 @@ export function getNativePythonFinder(context?: IExtensionContext): NativePython
540521 } ,
541522 } ;
542523 }
543- if ( _finder && isFinderDisposed ( _finder ) ) {
544- _finder = undefined ;
545- }
546524 if ( ! _finder ) {
547525 const cacheDirectory = context ? getCacheDirectory ( context ) : undefined ;
548526 _finder = new NativePythonFinderImpl ( cacheDirectory , context ) ;
@@ -553,18 +531,6 @@ export function getNativePythonFinder(context?: IExtensionContext): NativePython
553531 return _finder ;
554532}
555533
556- function isFinderDisposed ( finder : NativePythonFinder ) : boolean {
557- const finderImpl = finder as { isDisposed ?: boolean ; isConnectionClosed ?: boolean } ;
558- const disposed = Boolean ( finderImpl . isDisposed ) ;
559- const connectionClosed = Boolean ( finderImpl . isConnectionClosed ) ;
560- if ( disposed || connectionClosed ) {
561- traceError (
562- `[NativePythonFinder] Finder needs recreation: isDisposed=${ disposed } , isConnectionClosed=${ connectionClosed } ` ,
563- ) ;
564- }
565- return disposed || connectionClosed ;
566- }
567-
568534export function getCacheDirectory ( context : IExtensionContext ) : Uri {
569535 return Uri . joinPath ( context . globalStorageUri , 'pythonLocator' ) ;
570536}
@@ -573,14 +539,3 @@ export async function clearCacheDirectory(context: IExtensionContext): Promise<v
573539 const cacheDirectory = getCacheDirectory ( context ) ;
574540 await fs . emptyDir ( cacheDirectory . fsPath ) . catch ( noop ) ;
575541}
576-
577- /**
578- * Clears the singleton finder instance. For testing purposes only.
579- * @internal
580- */
581- export function clearNativePythonFinder ( ) : void {
582- if ( _finder ) {
583- _finder . dispose ( ) ;
584- _finder = undefined ;
585- }
586- }
0 commit comments