@@ -483,6 +483,7 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
483
483
const styler = attachInputBoxStyler ( inputBox , this . themeService ) ;
484
484
485
485
const lastDot = value . lastIndexOf ( '.' ) ;
486
+ let currentSelectionState = 'prefix' ;
486
487
487
488
inputBox . value = value ;
488
489
inputBox . focus ( ) ;
@@ -520,7 +521,22 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
520
521
label . setFile ( joinPath ( parent , value || ' ' ) , labelOptions ) ; // update label icon while typing!
521
522
} ) ,
522
523
DOM . addStandardDisposableListener ( inputBox . inputElement , DOM . EventType . KEY_DOWN , ( e : IKeyboardEvent ) => {
523
- if ( e . equals ( KeyCode . Enter ) ) {
524
+ if ( e . equals ( KeyCode . F2 ) ) {
525
+ const dotIndex = inputBox . value . lastIndexOf ( '.' ) ;
526
+ if ( stat . isDirectory || dotIndex === - 1 ) {
527
+ return ;
528
+ }
529
+ if ( currentSelectionState === 'prefix' ) {
530
+ currentSelectionState = 'all' ;
531
+ inputBox . select ( { start : 0 , end : inputBox . value . length } ) ;
532
+ } else if ( currentSelectionState === 'all' ) {
533
+ currentSelectionState = 'suffix' ;
534
+ inputBox . select ( { start : dotIndex + 1 , end : inputBox . value . length } ) ;
535
+ } else {
536
+ currentSelectionState = 'prefix' ;
537
+ inputBox . select ( { start : 0 , end : dotIndex } ) ;
538
+ }
539
+ } else if ( e . equals ( KeyCode . Enter ) ) {
524
540
if ( ! inputBox . validate ( ) ) {
525
541
done ( true , true ) ;
526
542
}
0 commit comments