@@ -33,7 +33,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
3333import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
3434import * as os from 'os' ;
3535import { webFrame , shell } from 'electron' ;
36- import { getPathLabel , getBaseLabel } from 'vs/base/common/labels' ;
36+ import { getBaseLabel } from 'vs/base/common/labels' ;
3737import { IViewlet } from 'vs/workbench/common/viewlet' ;
3838import { IPanel } from 'vs/workbench/common/panel' ;
3939import { IWorkspaceIdentifier , getWorkspaceLabel , ISingleFolderWorkspaceIdentifier , isSingleFolderWorkspaceIdentifier , isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces' ;
@@ -50,6 +50,8 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
5050import { Context } from 'vs/platform/contextkey/browser/contextKeyService' ;
5151import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue' ;
5252import { INotificationService } from 'vs/platform/notification/common/notification' ;
53+ import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay' ;
54+ import { dirname } from 'vs/base/common/resources' ;
5355
5456// --- actions
5557
@@ -705,6 +707,7 @@ export abstract class BaseOpenRecentAction extends Action {
705707 private quickOpenService : IQuickOpenService ,
706708 private contextService : IWorkspaceContextService ,
707709 private environmentService : IEnvironmentService ,
710+ private uriDisplayService : IUriDisplayService ,
708711 private keybindingService : IKeybindingService ,
709712 private instantiationService : IInstantiationService
710713 ) {
@@ -720,22 +723,22 @@ export abstract class BaseOpenRecentAction extends Action {
720723
721724 private openRecent ( recentWorkspaces : ( IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier ) [ ] , recentFiles : string [ ] ) : void {
722725
723- function toPick ( workspace : IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | string , separator : ISeparator , fileKind : FileKind , environmentService : IEnvironmentService , action : IAction ) : IFilePickOpenEntry {
726+ function toPick ( workspace : IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | string , separator : ISeparator , fileKind : FileKind , environmentService : IEnvironmentService , uriDisplayService : IUriDisplayService , action : IAction ) : IFilePickOpenEntry {
724727 let resource : URI ;
725728 let label : string ;
726729 let description : string ;
727730 if ( isSingleFolderWorkspaceIdentifier ( workspace ) ) {
728731 resource = workspace ;
729- label = getWorkspaceLabel ( workspace , environmentService ) ;
730- description = getPathLabel ( resource . with ( { path : paths . dirname ( resource . path ) } ) , environmentService ) ;
732+ label = getWorkspaceLabel ( workspace , environmentService , uriDisplayService ) ;
733+ description = uriDisplayService . getLabel ( resource . with ( { path : paths . dirname ( resource . path ) } ) ) ;
731734 } else if ( isWorkspaceIdentifier ( workspace ) ) {
732735 resource = URI . file ( workspace . configPath ) ;
733- label = getWorkspaceLabel ( workspace , environmentService ) ;
734- description = getPathLabel ( paths . dirname ( workspace . configPath ) , environmentService ) ;
736+ label = getWorkspaceLabel ( workspace , environmentService , uriDisplayService ) ;
737+ description = uriDisplayService . getLabel ( dirname ( resource ) ) ;
735738 } else {
736739 resource = URI . file ( workspace ) ;
737740 label = getBaseLabel ( workspace ) ;
738- description = getPathLabel ( paths . dirname ( workspace ) , environmentService ) ;
741+ description = uriDisplayService . getLabel ( dirname ( resource ) ) ;
739742 }
740743
741744 return {
@@ -760,8 +763,8 @@ export abstract class BaseOpenRecentAction extends Action {
760763 this . windowService . openWindow ( [ resource ] , { forceNewWindow, forceOpenWorkspaceAsFile : isFile } ) ;
761764 } ;
762765
763- const workspacePicks : IFilePickOpenEntry [ ] = recentWorkspaces . map ( ( workspace , index ) => toPick ( workspace , index === 0 ? { label : nls . localize ( 'workspaces' , "workspaces" ) } : void 0 , isSingleFolderWorkspaceIdentifier ( workspace ) ? FileKind . FOLDER : FileKind . ROOT_FOLDER , this . environmentService , ! this . isQuickNavigate ( ) ? this . instantiationService . createInstance ( RemoveFromRecentlyOpened , workspace ) : void 0 ) ) ;
764- const filePicks : IFilePickOpenEntry [ ] = recentFiles . map ( ( p , index ) => toPick ( p , index === 0 ? { label : nls . localize ( 'files' , "files" ) , border : true } : void 0 , FileKind . FILE , this . environmentService , ! this . isQuickNavigate ( ) ? this . instantiationService . createInstance ( RemoveFromRecentlyOpened , p ) : void 0 ) ) ;
766+ const workspacePicks : IFilePickOpenEntry [ ] = recentWorkspaces . map ( ( workspace , index ) => toPick ( workspace , index === 0 ? { label : nls . localize ( 'workspaces' , "workspaces" ) } : void 0 , isSingleFolderWorkspaceIdentifier ( workspace ) ? FileKind . FOLDER : FileKind . ROOT_FOLDER , this . environmentService , this . uriDisplayService , ! this . isQuickNavigate ( ) ? this . instantiationService . createInstance ( RemoveFromRecentlyOpened , workspace ) : void 0 ) ) ;
767+ const filePicks : IFilePickOpenEntry [ ] = recentFiles . map ( ( p , index ) => toPick ( p , index === 0 ? { label : nls . localize ( 'files' , "files" ) , border : true } : void 0 , FileKind . FILE , this . environmentService , this . uriDisplayService , ! this . isQuickNavigate ( ) ? this . instantiationService . createInstance ( RemoveFromRecentlyOpened , p ) : void 0 ) ) ;
765768
766769 // focus second entry if the first recent workspace is the current workspace
767770 let autoFocusSecondEntry : boolean = recentWorkspaces [ 0 ] && this . contextService . isCurrentWorkspace ( recentWorkspaces [ 0 ] ) ;
@@ -812,9 +815,10 @@ export class OpenRecentAction extends BaseOpenRecentAction {
812815 @IWorkspaceContextService contextService : IWorkspaceContextService ,
813816 @IEnvironmentService environmentService : IEnvironmentService ,
814817 @IKeybindingService keybindingService : IKeybindingService ,
815- @IInstantiationService instantiationService : IInstantiationService
818+ @IInstantiationService instantiationService : IInstantiationService ,
819+ @IUriDisplayService uriDisplayService : IUriDisplayService
816820 ) {
817- super ( id , label , windowService , quickOpenService , contextService , environmentService , keybindingService , instantiationService ) ;
821+ super ( id , label , windowService , quickOpenService , contextService , environmentService , uriDisplayService , keybindingService , instantiationService ) ;
818822 }
819823
820824 protected isQuickNavigate ( ) : boolean {
@@ -835,9 +839,10 @@ export class QuickOpenRecentAction extends BaseOpenRecentAction {
835839 @IWorkspaceContextService contextService : IWorkspaceContextService ,
836840 @IEnvironmentService environmentService : IEnvironmentService ,
837841 @IKeybindingService keybindingService : IKeybindingService ,
838- @IInstantiationService instantiationService : IInstantiationService
842+ @IInstantiationService instantiationService : IInstantiationService ,
843+ @IUriDisplayService uriDisplayService : IUriDisplayService
839844 ) {
840- super ( id , label , windowService , quickOpenService , contextService , environmentService , keybindingService , instantiationService ) ;
845+ super ( id , label , windowService , quickOpenService , contextService , environmentService , uriDisplayService , keybindingService , instantiationService ) ;
841846 }
842847
843848 protected isQuickNavigate ( ) : boolean {
0 commit comments