@@ -340,7 +340,8 @@ export class RemoteFileDialog {
340340 const relativePath = resources . relativePath ( currentDisplayUri , directUri ) ;
341341 const isSameRoot = ( this . filePickBox . value . length > 1 && currentPath . length > 1 ) ? equalsIgnoreCase ( this . filePickBox . value . substr ( 0 , 2 ) , currentPath . substr ( 0 , 2 ) ) : false ;
342342 if ( relativePath && isSameRoot ) {
343- return resources . joinPath ( this . currentFolder , relativePath ) ;
343+ const path = resources . joinPath ( this . currentFolder , relativePath ) ;
344+ return resources . hasTrailingPathSeparator ( directUri ) ? resources . addTrailingPathSeparator ( path ) : path ;
344345 } else {
345346 return directUri ;
346347 }
@@ -357,22 +358,23 @@ export class RemoteFileDialog {
357358 // When possible, cause the update to happen by modifying the input box.
358359 // This allows all input box updates to happen first, and uses the same code path as the user typing.
359360 const newPath = this . pathFromUri ( item . uri ) ;
360- if ( startsWithIgnoreCase ( newPath , this . filePickBox . value ) ) {
361- const insertValue = newPath . substring ( this . filePickBox . value . length , newPath . length ) ;
362- this . filePickBox . valueSelection = [ this . filePickBox . value . length , this . filePickBox . value . length ] ;
363- this . insertText ( newPath , insertValue ) ;
361+ if ( startsWithIgnoreCase ( newPath , this . filePickBox . value ) && ( equalsIgnoreCase ( item . label , resources . basename ( item . uri ) ) ) ) {
362+ this . filePickBox . valueSelection = [ this . pathFromUri ( this . currentFolder ) . length , this . filePickBox . value . length ] ;
363+ this . insertText ( newPath , item . label ) ;
364364 } else if ( ( item . label === '..' ) && startsWithIgnoreCase ( this . filePickBox . value , newPath ) ) {
365365 this . filePickBox . valueSelection = [ newPath . length , this . filePickBox . value . length ] ;
366366 this . insertText ( newPath , '' ) ;
367367 } else {
368368 await this . updateItems ( item . uri , true ) ;
369369 }
370370 }
371+ this . filePickBox . busy = false ;
371372 return ;
372373 }
373374 } else {
374375 // If the items have updated, don't try to resolve
375376 if ( ( await this . tryUpdateItems ( this . filePickBox . value , this . filePickBoxValue ( ) ) ) !== UpdateResult . NotUpdated ) {
377+ this . filePickBox . busy = false ;
376378 return ;
377379 }
378380 }
@@ -403,7 +405,7 @@ export class RemoteFileDialog {
403405 }
404406 await this . updateItems ( newDir , true ) ;
405407 return UpdateResult . Updated ;
406- } else if ( ! resources . isEqual ( this . currentFolder , valueUri , true ) && ( this . endsWithSlash ( value ) || ( ! resources . isEqual ( this . currentFolder , resources . dirname ( valueUri ) , true ) && resources . isEqualOrParent ( this . currentFolder , resources . dirname ( valueUri ) , true ) ) ) ) {
408+ } else if ( ( ! resources . isEqual ( this . currentFolder , valueUri , true ) && ( this . endsWithSlash ( value ) ) || ( ! resources . isEqual ( this . currentFolder , resources . dirname ( valueUri ) , true ) && resources . isEqualOrParent ( this . currentFolder , resources . dirname ( valueUri ) , true ) ) ) ) {
407409 let stat : IFileStat | undefined ;
408410 try {
409411 stat = await this . fileService . resolve ( valueUri ) ;
0 commit comments