File tree Expand file tree Collapse file tree
src/client/pythonEnvironments/base/locators/lowLevel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,6 +92,17 @@ export abstract class FSWatchingLocator extends LazyResourceBasedLocator {
9292 if ( typeof roots === 'string' ) {
9393 roots = [ roots ] ;
9494 }
95+ const promises = roots . map ( async ( root ) => {
96+ // Note that we only check the root dir. Any directories
97+ // that might be watched due to a glob are not checked.
98+ const unwatchable = await checkDirWatchable ( root ) ;
99+ if ( unwatchable ) {
100+ logError ( `dir "${ root } " is not watchable (${ unwatchable } )` ) ;
101+ return undefined ;
102+ }
103+ return root ;
104+ } ) ;
105+ const watchableRoots = ( await Promise . all ( promises ) ) . filter ( ( root ) => ! ! root ) as string [ ] ;
95106
96107 // Enable all workspace watchers.
97108 if ( this . watcherKind === FSWatcherKind . Global ) {
@@ -102,16 +113,7 @@ export abstract class FSWatchingLocator extends LazyResourceBasedLocator {
102113 }
103114 }
104115
105- roots . forEach ( ( root ) => {
106- // Note that we only check the root dir. Any directories
107- // that might be watched due to a glob are not checked.
108- const unwatchable = checkDirWatchable ( root ) ;
109- if ( unwatchable ) {
110- logError ( `dir "${ root } " is not watchable (${ unwatchable } )` ) ;
111- } else {
112- this . startWatchers ( root ) ;
113- }
114- } ) ;
116+ watchableRoots . forEach ( ( root ) => this . startWatchers ( root ) ) ;
115117 }
116118
117119 private startWatchers ( root : string ) : void {
You can’t perform that action at this time.
0 commit comments