@@ -22,12 +22,12 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
2222import { IFileService } from 'vs/platform/files/common/files' ;
2323import { FileService } from 'vs/platform/files/common/fileService' ;
2424import { 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' ;
2626import { IWorkbenchConfigurationService } from 'vs/workbench/services/configuration/common/configuration' ;
2727import { onUnexpectedError } from 'vs/base/common/errors' ;
2828import { 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' ;
3131import { WorkspaceService } from 'vs/workbench/services/configuration/browser/configurationService' ;
3232import { ConfigurationCache } from 'vs/workbench/services/configuration/common/configurationCache' ;
3333import { ISignService } from 'vs/platform/sign/common/sign' ;
@@ -68,7 +68,6 @@ import { safeStringify } from 'vs/base/common/objects';
6868import { ICredentialsService } from 'vs/workbench/services/credentials/common/credentials' ;
6969import { IndexedDB } from 'vs/base/browser/indexedDB' ;
7070import { CodeServerClientAdditions } from 'vs/workbench/browser/client' ;
71- import { BrowserWorkspacesService } from 'vs/workbench/services/workspaces/browser/workspacesService' ;
7271
7372class BrowserMain extends Disposable {
7473
@@ -222,68 +221,6 @@ class BrowserMain extends Disposable {
222221 } )
223222 ] ) ;
224223
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-
287224 // Workspace Trust Service
288225 const workspaceTrustEnablementService = new WorkspaceTrustEnablementService ( configurationService , environmentService ) ;
289226 serviceCollection . set ( IWorkspaceTrustEnablementService , workspaceTrustEnablementService ) ;
0 commit comments