@@ -22,12 +22,12 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
22
22
import { IFileService } from 'vs/platform/files/common/files' ;
23
23
import { FileService } from 'vs/platform/files/common/fileService' ;
24
24
import { Schemas } from 'vs/base/common/network' ;
25
- import { IWorkspaceContextService , toWorkspaceFolder } from 'vs/platform/workspace/common/workspace' ;
25
+ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
26
26
import { IWorkbenchConfigurationService } from 'vs/workbench/services/configuration/common/configuration' ;
27
27
import { onUnexpectedError } from 'vs/base/common/errors' ;
28
28
import { setFullscreen } from 'vs/base/browser/browser' ;
29
- import { encodePath , URI } from 'vs/base/common/uri' ;
30
- import { isRecentFolder , IWorkspaceInitializationPayload , IWorkspacesService } from 'vs/platform/workspaces/common/workspaces' ;
29
+ import { URI } from 'vs/base/common/uri' ;
30
+ import { IWorkspaceInitializationPayload } from 'vs/platform/workspaces/common/workspaces' ;
31
31
import { WorkspaceService } from 'vs/workbench/services/configuration/browser/configurationService' ;
32
32
import { ConfigurationCache } from 'vs/workbench/services/configuration/common/configurationCache' ;
33
33
import { ISignService } from 'vs/platform/sign/common/sign' ;
@@ -68,7 +68,6 @@ import { safeStringify } from 'vs/base/common/objects';
68
68
import { ICredentialsService } from 'vs/workbench/services/credentials/common/credentials' ;
69
69
import { IndexedDB } from 'vs/base/browser/indexedDB' ;
70
70
import { CodeServerClientAdditions } from 'vs/workbench/browser/client' ;
71
- import { BrowserWorkspacesService } from 'vs/workbench/services/workspaces/browser/workspacesService' ;
72
71
73
72
class BrowserMain extends Disposable {
74
73
@@ -222,68 +221,6 @@ class BrowserMain extends Disposable {
222
221
} )
223
222
] ) ;
224
223
225
- /**
226
- * Added to persist recent workspaces in the browser.
227
- * These behaviors may disabled with the `--ignore-last-opened` argument.
228
- *
229
- * @author coder
230
- * @example User specified a directory at startup.
231
- * ```sh
232
- * code-server ./path/to/project/
233
- * ```
234
- *
235
- * @example Blank project without CLI arguments,
236
- * using the last opened directory in the browser.
237
- * ```sh
238
- * code-server
239
- * open http://localhost:8000/
240
- * ```
241
- *
242
- * @example Query params override CLI arguments.
243
- * ```sh
244
- * code-server ./path/to/project/
245
- * open http://localhost:8000/?folder=/path/to/different/project
246
- * ```
247
- */
248
- const browserWorkspacesService = new BrowserWorkspacesService ( storageService , configurationService , logService , fileService , environmentService , uriIdentityService ) ;
249
- serviceCollection . set ( IWorkspacesService , browserWorkspacesService ) ;
250
- const workspace = configurationService . getWorkspace ( ) ;
251
-
252
- logService . debug ( 'Workspace configuration' , {
253
- workspaceFolders : workspace . folders ,
254
- ignoreLastOpened : environmentService . ignoreLastOpened ,
255
- } ) ;
256
-
257
- if ( workspace . folders . length === 0 && ! environmentService . ignoreLastOpened ) {
258
- logService . debug ( 'Workspace is empty. Checking for recent folders...' ) ;
259
-
260
- const recentlyOpened = await browserWorkspacesService . getRecentlyOpened ( ) ;
261
-
262
- for ( const recent of recentlyOpened . workspaces ) {
263
- if ( isRecentFolder ( recent ) ) {
264
- logService . debug ( 'Recent folder found...' ) ;
265
- const folder = toWorkspaceFolder ( recent . folderUri ) ;
266
- // Note that the `folders` property should be reassigned instead of pushed into.
267
- // This property has a setter which updates the workspace's file cache.
268
- workspace . folders = [ folder ] ;
269
-
270
-
271
- /**
272
- * Opening a folder from the browser navigates to a URL including the folder param.
273
- * However, since we're overriding the default state of a blank editor,
274
- * we update the URL query param to match this behavior.
275
- * This is especially useful when a user wants to share a link to server with a specific folder.
276
- *
277
- * @see `WorkspaceProvider.createTargetUrl`
278
- * @see `WorkspaceProvider.QUERY_PARAM_FOLDER`
279
- */
280
- const nextQueryParam = `?folder=${ encodePath ( folder . uri . path ) } ` ;
281
- window . history . replaceState ( null , '' , nextQueryParam ) ;
282
- break ;
283
- }
284
- }
285
- }
286
-
287
224
// Workspace Trust Service
288
225
const workspaceTrustEnablementService = new WorkspaceTrustEnablementService ( configurationService , environmentService ) ;
289
226
serviceCollection . set ( IWorkspaceTrustEnablementService , workspaceTrustEnablementService ) ;
0 commit comments