11import * as electron from "electron" ;
22import { Emitter } from "@coder/events" ;
3- import { IWindowsService , INativeOpenDialogOptions , MessageBoxOptions , SaveDialogOptions , OpenDialogOptions , IMessageBoxResult , IDevToolsOptions , IEnterWorkspaceResult , CrashReporterStartOptions , INewWindowOptions , IOpenFileRequest , IAddFoldersRequest } from "vs/platform/windows/common/windows" ;
3+ import { logger } from "@coder/logger" ;
4+ import { IWindowsService , INativeOpenDialogOptions , MessageBoxOptions , SaveDialogOptions , OpenDialogOptions , IMessageBoxResult , IDevToolsOptions , IEnterWorkspaceResult , CrashReporterStartOptions , INewWindowOptions , IOpenFileRequest , IAddFoldersRequest , IURIToOpen , IOpenSettings } from "vs/platform/windows/common/windows" ;
45import { ParsedArgs } from "vs/platform/environment/common/environment" ;
56import { IWorkspaceIdentifier , IWorkspaceFolderCreationData , ISingleFolderWorkspaceIdentifier } from "vs/platform/workspaces/common/workspaces" ;
67import { URI } from "vs/base/common/uri" ;
7- import { IRecentlyOpened } from "vs/platform/history/common/history" ;
8+ import { IRecentlyOpened , IRecent } from "vs/platform/history/common/history" ;
89import { ISerializableCommandAction } from "vs/platform/actions/common/actions" ;
910import { client } from "../client" ;
1011import { showOpenDialog } from "../dialog" ;
1112import { workbench } from "../workbench" ;
1213
14+ // tslint:disable completed-docs
15+
1316// VS Code overrides window.open to call openExternal, but we then call
1417// window.open which results in an infinite loop. Store the function but also
1518// make it unable to be set (doesn't work otherwise).
@@ -59,7 +62,7 @@ export class WindowsService implements IWindowsService {
5962 } ] ,
6063 } as IOpenFileRequest ) ;
6164 } ) . catch ( ( ex ) => {
62- //
65+ logger . error ( ex . message ) ;
6366 } ) ;
6467 }
6568
@@ -77,7 +80,7 @@ export class WindowsService implements IWindowsService {
7780 } ] ,
7881 } as IOpenFileRequest ) ;
7982 } ) . catch ( ( ex ) => {
80- //
83+ logger . error ( ex . message ) ;
8184 } ) ;
8285 }
8386
@@ -90,7 +93,7 @@ export class WindowsService implements IWindowsService {
9093 } ) . then ( ( path ) => {
9194 workbench . workspace = URI . file ( path ) ;
9295 } ) . catch ( ( ex ) => {
93- //
96+ logger . error ( ex . message ) ;
9497 } ) ;
9598 }
9699
@@ -106,7 +109,7 @@ export class WindowsService implements IWindowsService {
106109 foldersToAdd : [ URI . file ( path ) ] ,
107110 } as IAddFoldersRequest ) ;
108111 } ) . catch ( ( ex ) => {
109- //
112+ logger . error ( ex . message ) ;
110113 } ) ;
111114 }
112115
@@ -129,16 +132,14 @@ export class WindowsService implements IWindowsService {
129132 } ) ;
130133 }
131134
132- public showOpenDialog ( windowId : number , options : OpenDialogOptions ) : Promise < string [ ] > {
133- return showOpenDialog ( {
135+ public async showOpenDialog ( _windowId : number , options : OpenDialogOptions ) : Promise < string [ ] > {
136+ return [ await showOpenDialog ( {
134137 ...( options || { } ) ,
135138 properties : {
136139 openDirectory : true ,
137140 openFile : true ,
138141 } ,
139- } ) . then ( ( path ) => {
140- return [ path ] ;
141- } ) ;
142+ } ) ] ;
142143 }
143144
144145 public reloadWindow ( windowId : number , _args ?: ParsedArgs ) : Promise < void > {
@@ -157,14 +158,14 @@ export class WindowsService implements IWindowsService {
157158 throw new Error ( "not implemented" ) ;
158159 }
159160
160- public enterWorkspace ( _windowId : number , _path : URI ) : Promise < IEnterWorkspaceResult > {
161- if ( _path . path . endsWith ( ".json" ) ) {
161+ public enterWorkspace ( _windowId : number , uri : URI ) : Promise < IEnterWorkspaceResult > {
162+ if ( uri . path . endsWith ( ".json" ) ) {
162163 workbench . workspace = {
163164 id : "Untitled" ,
164- configPath : _path . path ,
165+ configPath : uri ,
165166 } ;
166167 } else {
167- workbench . workspace = _path ;
168+ workbench . workspace = uri ;
168169 }
169170
170171 return undefined ! ;
@@ -188,7 +189,7 @@ export class WindowsService implements IWindowsService {
188189 return Promise . resolve ( this . getWindowById ( windowId ) . setRepresentedFilename ( fileName ) ) ;
189190 }
190191
191- public addRecentlyOpened ( _files : URI [ ] ) : Promise < void > {
192+ public addRecentlyOpened ( _files : IRecent [ ] ) : Promise < void > {
192193 throw new Error ( "not implemented" ) ;
193194 }
194195
@@ -292,7 +293,7 @@ export class WindowsService implements IWindowsService {
292293 }
293294
294295 // Global methods
295- public openWindow ( _windowId : number , _paths : URI [ ] , _options ?: { forceNewWindow ?: boolean , forceReuseWindow ?: boolean , forceOpenWorkspaceAsFile ?: boolean , args ?: ParsedArgs } ) : Promise < void > {
296+ public openWindow ( _windowId : number , _uris : IURIToOpen [ ] , _options ?: IOpenSettings ) : Promise < void > {
296297 throw new Error ( "not implemented" ) ;
297298 }
298299
@@ -316,8 +317,8 @@ export class WindowsService implements IWindowsService {
316317 throw new Error ( "not implemented" ) ;
317318 }
318319
319- public async showItemInFolder ( _path : string ) : Promise < void > {
320- workbench . workspace = URI . file ( _path ) ;
320+ public async showItemInFolder ( uri : URI ) : Promise < void > {
321+ workbench . workspace = uri ;
321322 }
322323
323324 public getActiveWindowId ( ) : Promise < number | undefined > {
0 commit comments