1
1
import * as electron from "electron" ;
2
2
import { 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" ;
4
5
import { ParsedArgs } from "vs/platform/environment/common/environment" ;
5
6
import { IWorkspaceIdentifier , IWorkspaceFolderCreationData , ISingleFolderWorkspaceIdentifier } from "vs/platform/workspaces/common/workspaces" ;
6
7
import { 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" ;
8
9
import { ISerializableCommandAction } from "vs/platform/actions/common/actions" ;
9
10
import { client } from "../client" ;
10
11
import { showOpenDialog } from "../dialog" ;
11
12
import { workbench } from "../workbench" ;
12
13
14
+ // tslint:disable completed-docs
15
+
13
16
// VS Code overrides window.open to call openExternal, but we then call
14
17
// window.open which results in an infinite loop. Store the function but also
15
18
// make it unable to be set (doesn't work otherwise).
@@ -59,7 +62,7 @@ export class WindowsService implements IWindowsService {
59
62
} ] ,
60
63
} as IOpenFileRequest ) ;
61
64
} ) . catch ( ( ex ) => {
62
- //
65
+ logger . error ( ex . message ) ;
63
66
} ) ;
64
67
}
65
68
@@ -77,7 +80,7 @@ export class WindowsService implements IWindowsService {
77
80
} ] ,
78
81
} as IOpenFileRequest ) ;
79
82
} ) . catch ( ( ex ) => {
80
- //
83
+ logger . error ( ex . message ) ;
81
84
} ) ;
82
85
}
83
86
@@ -90,7 +93,7 @@ export class WindowsService implements IWindowsService {
90
93
} ) . then ( ( path ) => {
91
94
workbench . workspace = URI . file ( path ) ;
92
95
} ) . catch ( ( ex ) => {
93
- //
96
+ logger . error ( ex . message ) ;
94
97
} ) ;
95
98
}
96
99
@@ -106,7 +109,7 @@ export class WindowsService implements IWindowsService {
106
109
foldersToAdd : [ URI . file ( path ) ] ,
107
110
} as IAddFoldersRequest ) ;
108
111
} ) . catch ( ( ex ) => {
109
- //
112
+ logger . error ( ex . message ) ;
110
113
} ) ;
111
114
}
112
115
@@ -129,16 +132,14 @@ export class WindowsService implements IWindowsService {
129
132
} ) ;
130
133
}
131
134
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 ( {
134
137
...( options || { } ) ,
135
138
properties : {
136
139
openDirectory : true ,
137
140
openFile : true ,
138
141
} ,
139
- } ) . then ( ( path ) => {
140
- return [ path ] ;
141
- } ) ;
142
+ } ) ] ;
142
143
}
143
144
144
145
public reloadWindow ( windowId : number , _args ?: ParsedArgs ) : Promise < void > {
@@ -157,14 +158,14 @@ export class WindowsService implements IWindowsService {
157
158
throw new Error ( "not implemented" ) ;
158
159
}
159
160
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" ) ) {
162
163
workbench . workspace = {
163
164
id : "Untitled" ,
164
- configPath : _path . path ,
165
+ configPath : uri ,
165
166
} ;
166
167
} else {
167
- workbench . workspace = _path ;
168
+ workbench . workspace = uri ;
168
169
}
169
170
170
171
return undefined ! ;
@@ -188,7 +189,7 @@ export class WindowsService implements IWindowsService {
188
189
return Promise . resolve ( this . getWindowById ( windowId ) . setRepresentedFilename ( fileName ) ) ;
189
190
}
190
191
191
- public addRecentlyOpened ( _files : URI [ ] ) : Promise < void > {
192
+ public addRecentlyOpened ( _files : IRecent [ ] ) : Promise < void > {
192
193
throw new Error ( "not implemented" ) ;
193
194
}
194
195
@@ -292,7 +293,7 @@ export class WindowsService implements IWindowsService {
292
293
}
293
294
294
295
// 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 > {
296
297
throw new Error ( "not implemented" ) ;
297
298
}
298
299
@@ -316,8 +317,8 @@ export class WindowsService implements IWindowsService {
316
317
throw new Error ( "not implemented" ) ;
317
318
}
318
319
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 ;
321
322
}
322
323
323
324
public getActiveWindowId ( ) : Promise < number | undefined > {
0 commit comments