66import { Event } from 'vs/base/common/event' ;
77import { IChannel , IServerChannel } from 'vs/base/parts/ipc/node/ipc' ;
88import { IWindowsService , INativeOpenDialogOptions , IEnterWorkspaceResult , CrashReporterStartOptions , IMessageBoxResult , MessageBoxOptions , SaveDialogOptions , OpenDialogOptions , IDevToolsOptions , INewWindowOptions } from 'vs/platform/windows/common/windows' ;
9- import { IWorkspaceIdentifier , ISingleFolderWorkspaceIdentifier , isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces' ;
9+ import { IWorkspaceIdentifier , ISingleFolderWorkspaceIdentifier , isWorkspaceIdentifier , reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces' ;
1010import { IRecentlyOpened } from 'vs/platform/history/common/history' ;
1111import { ISerializableCommandAction } from 'vs/platform/actions/common/actions' ;
1212import { URI } from 'vs/base/common/uri' ;
@@ -63,7 +63,7 @@ export class WindowsChannel implements IServerChannel {
6363 case 'removeFromRecentlyOpened' : {
6464 let paths : Array < IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI | string > = arg ;
6565 if ( Array . isArray ( paths ) ) {
66- paths = paths . map ( path => isWorkspaceIdentifier ( path ) || typeof path === 'string' ? path : URI . revive ( path ) ) ;
66+ paths = paths . map ( path => isWorkspaceIdentifier ( path ) ? reviveWorkspaceIdentifier ( path ) : typeof path === 'string' ? path : URI . revive ( path ) ) ;
6767 }
6868 return this . service . removeFromRecentlyOpened ( paths ) ;
6969 }
@@ -165,7 +165,9 @@ export class WindowsChannelClient implements IWindowsService {
165165 }
166166
167167 enterWorkspace ( windowId : number , path : URI ) : Promise < IEnterWorkspaceResult > {
168- return this . channel . call ( 'enterWorkspace' , [ windowId , path ] ) ;
168+ return this . channel . call ( 'enterWorkspace' , [ windowId , path ] ) . then ( ( result : IEnterWorkspaceResult ) => {
169+ return { backupPath : result . backupPath , workspace : reviveWorkspaceIdentifier ( result . workspace ) } ;
170+ } ) ;
169171 }
170172
171173 toggleFullScreen ( windowId : number ) : Promise < void > {
@@ -191,7 +193,7 @@ export class WindowsChannelClient implements IWindowsService {
191193 getRecentlyOpened ( windowId : number ) : Promise < IRecentlyOpened > {
192194 return this . channel . call ( 'getRecentlyOpened' , windowId )
193195 . then ( ( recentlyOpened : IRecentlyOpened ) => {
194- recentlyOpened . workspaces = recentlyOpened . workspaces . map ( workspace => isWorkspaceIdentifier ( workspace ) ? workspace : URI . revive ( workspace ) ) ;
196+ recentlyOpened . workspaces = recentlyOpened . workspaces . map ( workspace => isWorkspaceIdentifier ( workspace ) ? reviveWorkspaceIdentifier ( workspace ) : URI . revive ( workspace ) ) ;
195197 recentlyOpened . files = recentlyOpened . files . map ( URI . revive ) ;
196198 return recentlyOpened ;
197199 } ) ;
@@ -286,7 +288,17 @@ export class WindowsChannelClient implements IWindowsService {
286288 }
287289
288290 getWindows ( ) : Promise < { id : number ; workspace ?: IWorkspaceIdentifier ; folderUri ?: ISingleFolderWorkspaceIdentifier ; title : string ; filename ?: string ; } [ ] > {
289- return this . channel . call < { id : number ; workspace ?: IWorkspaceIdentifier ; folderUri ?: ISingleFolderWorkspaceIdentifier ; title : string ; filename ?: string ; } [ ] > ( 'getWindows' ) . then ( result => { result . forEach ( win => win . folderUri = win . folderUri ? URI . revive ( win . folderUri ) : win . folderUri ) ; return result ; } ) ;
291+ return this . channel . call < { id : number ; workspace ?: IWorkspaceIdentifier ; folderUri ?: ISingleFolderWorkspaceIdentifier ; title : string ; filename ?: string ; } [ ] > ( 'getWindows' ) . then ( result => {
292+ for ( const win of result ) {
293+ if ( win . folderUri ) {
294+ win . folderUri = URI . revive ( win . folderUri ) ;
295+ }
296+ if ( win . workspace ) {
297+ win . workspace = reviveWorkspaceIdentifier ( win . workspace ) ;
298+ }
299+ }
300+ return result ;
301+ } ) ;
290302 }
291303
292304 getWindowCount ( ) : Promise < number > {
0 commit comments