File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
packages/pyright-internal/src Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -215,20 +215,19 @@ export class ReadOnlyAugmentedFileSystem implements FileSystem {
215215 private _findClosestMatch ( uri : Uri , map : UriMap < MappedEntry > ) : MappedEntry | undefined {
216216 // Search through the map of directories to find the closest match. The
217217 // closest match is the longest path that is a parent of the uri.
218- let entry = map . get ( uri ) ;
219- if ( ! entry ) {
220- let foundKey = undefined ;
221- for ( const [ key , value ] of map . entries ( ) ) {
222- if ( uri . isChild ( key ) ) {
223- // Update the found key if it is a better match.
224- if ( ! foundKey || foundKey . getPathLength ( ) < key . getPathLength ( ) ) {
225- foundKey = key ;
226- entry = value ;
227- }
228- }
218+ while ( true ) {
219+ const entry = map . get ( uri ) ;
220+ if ( entry ) {
221+ return entry ;
222+ }
223+
224+ const parent = uri . getDirectory ( ) ;
225+ if ( parent . equals ( uri ) ) {
226+ return undefined ;
229227 }
228+
229+ uri = parent ;
230230 }
231- return entry ;
232231 }
233232
234233 private _getOriginalEntry ( uri : Uri ) : MappedEntry | undefined {
You can’t perform that action at this time.
0 commit comments