diff --git a/src/vs/editor/browser/standalone/standaloneServices.ts b/src/vs/editor/browser/standalone/standaloneServices.ts index d641a57f51d..4c81033228e 100644 --- a/src/vs/editor/browser/standalone/standaloneServices.ts +++ b/src/vs/editor/browser/standalone/standaloneServices.ts @@ -28,7 +28,7 @@ import {IMessageService} from 'vs/platform/message/common/message'; import {IProgressService} from 'vs/platform/progress/common/progress'; import {IStorageService, NullStorageService} from 'vs/platform/storage/common/storage'; import {ITelemetryService, NullTelemetryService} from 'vs/platform/telemetry/common/telemetry'; -import {IWorkspaceContextService, BaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; +import {IWorkspaceContextService, WorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService'; import {IEditorWorkerService} from 'vs/editor/common/services/editorWorkerService'; import {EditorWorkerServiceImpl} from 'vs/editor/common/services/editorWorkerServiceImpl'; @@ -237,12 +237,8 @@ export function getOrCreateStaticServices(services?: IEditorOverrideServices): I let serviceCollection = new ServiceCollection(); const instantiationService = new InstantiationService(serviceCollection, true); - let contextService = services.contextService || new BaseWorkspaceContextService({ - resource: URI.from({ scheme: 'inmemory', authority: 'model', path: '/' }), - id: null, - name: null, - uid: null, - mtime: null + let contextService = services.contextService || new WorkspaceContextService({ + resource: URI.from({ scheme: 'inmemory', authority: 'model', path: '/' }) }); serviceCollection.set(IWorkspaceContextService, contextService); diff --git a/src/vs/platform/workspace/common/workspace.ts b/src/vs/platform/workspace/common/workspace.ts index a47d31d6777..f947e751743 100644 --- a/src/vs/platform/workspace/common/workspace.ts +++ b/src/vs/platform/workspace/common/workspace.ts @@ -45,34 +45,20 @@ export interface IWorkspace { */ resource: URI; - /** - * the identifier that uniquely identifies this workspace among others. - */ - id: string; - - /** - * the name of the workspace - */ - name: string; - - /** - * the last modified date of the workspace if known - */ - mtime?: number; - /** * the unique identifier of the workspace. if the workspace is deleted and recreated * the identifier also changes. this makes the uid more unique compared to the id which * is just derived from the workspace name. */ uid?: number; + + /** + * the name of the workspace + */ + name?: string; } -/** - * Simple IWorkspaceContextService implementation to allow sharing of this service implementation - * between different layers of the platform. - */ -export class BaseWorkspaceContextService implements IWorkspaceContextService { +export class WorkspaceContextService implements IWorkspaceContextService { public _serviceBrand: any; diff --git a/src/vs/test/utils/servicesTestUtils.ts b/src/vs/test/utils/servicesTestUtils.ts index 3173a72219a..03d5974274f 100644 --- a/src/vs/test/utils/servicesTestUtils.ts +++ b/src/vs/test/utils/servicesTestUtils.ts @@ -45,10 +45,8 @@ import {EnvironmentService} from 'vs/platform/environment/node/environmentServic export const TestWorkspace: IWorkspace = { resource: URI.file('C:\\testWorkspace'), - id: 'testWorkspace', name: 'Test Workspace', - uid: new Date().getTime(), - mtime: new Date().getTime() + uid: new Date().getTime() }; export const TestEnvironmentService = new EnvironmentService(Objects.assign(parseArgs(process.argv), { execPath: process.execPath })); diff --git a/src/vs/workbench/common/storage.ts b/src/vs/workbench/common/storage.ts index 43a530b6ae9..74b7963922a 100644 --- a/src/vs/workbench/common/storage.ts +++ b/src/vs/workbench/common/storage.ts @@ -49,7 +49,7 @@ export class Storage implements IStorageService { this.workspaceKey = this.getWorkspaceKey(workspace); // Make sure to delete all workspace storage if the workspace has been recreated meanwhile - const workspaceUniqueId: number = workspace ? workspace.uid : null; + const workspaceUniqueId: number = workspace ? workspace.uid : void 0; if (types.isNumber(workspaceUniqueId)) { this.cleanupWorkspaceScope(workspaceUniqueId, workspace.name); } diff --git a/src/vs/workbench/electron-browser/main.ts b/src/vs/workbench/electron-browser/main.ts index 26454378cca..8ed5abafcd5 100644 --- a/src/vs/workbench/electron-browser/main.ts +++ b/src/vs/workbench/electron-browser/main.ts @@ -122,10 +122,8 @@ function getWorkspace(workspacePath: string): IWorkspace { return { 'resource': workspaceResource, - 'id': platform.isLinux ? realWorkspacePath : realWorkspacePath.toLowerCase(), 'name': folderName, - 'uid': platform.isLinux ? folderStat.ino : folderStat.birthtime.getTime(), // On Linux, birthtime is ctime, so we cannot use it! We use the ino instead! - 'mtime': folderStat.mtime.getTime() + 'uid': platform.isLinux ? folderStat.ino : folderStat.birthtime.getTime() // On Linux, birthtime is ctime, so we cannot use it! We use the ino instead! }; } diff --git a/src/vs/workbench/node/extensionHostMain.ts b/src/vs/workbench/node/extensionHostMain.ts index dbd76b6305c..95c45f5bf92 100644 --- a/src/vs/workbench/node/extensionHostMain.ts +++ b/src/vs/workbench/node/extensionHostMain.ts @@ -22,7 +22,7 @@ import {ExtHostExtensionService} from 'vs/workbench/api/node/extHostExtensionSer import {ExtHostThreadService} from 'vs/workbench/services/thread/common/extHostThreadService'; import {RemoteTelemetryService} from 'vs/workbench/api/node/extHostTelemetry'; import {ExtensionScanner, MessagesCollector} from 'vs/workbench/node/extensionPoints'; -import {IWorkspaceContextService, BaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; +import {IWorkspaceContextService, WorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {Client} from 'vs/base/parts/ipc/node/ipc.net'; import {IExtensionManagementChannel, ExtensionManagementChannelClient} from 'vs/platform/extensionManagement/common/extensionManagementIpc'; @@ -72,7 +72,7 @@ export class ExtensionHostMain { this._environment = initData.environment; - this._contextService = new BaseWorkspaceContextService(initData.contextService.workspace); + this._contextService = new WorkspaceContextService(initData.contextService.workspace); const workspaceStoragePath = this._getOrCreateWorkspaceStoragePath(); const threadService = new ExtHostThreadService(remoteCom); diff --git a/src/vs/workbench/services/workspace/common/contextService.ts b/src/vs/workbench/services/workspace/common/contextService.ts index d90a94f4276..326ccf9d1c4 100644 --- a/src/vs/workbench/services/workspace/common/contextService.ts +++ b/src/vs/workbench/services/workspace/common/contextService.ts @@ -7,9 +7,9 @@ import {IOptions} from 'vs/workbench/common/options'; import {EventType, OptionsChangeEvent} from 'vs/workbench/common/events'; import {IEventService} from 'vs/platform/event/common/event'; -import {IWorkspace, BaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; +import {IWorkspace, WorkspaceContextService} from 'vs/platform/workspace/common/workspace'; -export class LegacyWorkspaceContextService extends BaseWorkspaceContextService { +export class LegacyWorkspaceContextService extends WorkspaceContextService { constructor( private eventService: IEventService, diff --git a/src/vs/workbench/test/browser/part.test.ts b/src/vs/workbench/test/browser/part.test.ts index 702a525415c..26a87d173ad 100644 --- a/src/vs/workbench/test/browser/part.test.ts +++ b/src/vs/workbench/test/browser/part.test.ts @@ -10,7 +10,7 @@ import {Build, Builder} from 'vs/base/browser/builder'; import {Part} from 'vs/workbench/browser/part'; import * as Types from 'vs/base/common/types'; import * as TestUtils from 'vs/test/utils/servicesTestUtils'; -import {IWorkspaceContextService, BaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; +import {IWorkspaceContextService, WorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {IStorageService} from 'vs/platform/storage/common/storage'; import {Storage, InMemoryLocalStorage} from 'vs/workbench/common/storage'; @@ -104,7 +104,7 @@ suite('Workbench Part', () => { fixture = document.createElement('div'); fixture.id = fixtureId; document.body.appendChild(fixture); - context = new BaseWorkspaceContextService(TestUtils.TestWorkspace); + context = new WorkspaceContextService(TestUtils.TestWorkspace); storage = new Storage(new InMemoryLocalStorage(), null, context); }); diff --git a/src/vs/workbench/test/browser/parts/quickOpen/quickopen.perf.test.ts b/src/vs/workbench/test/browser/parts/quickOpen/quickopen.perf.test.ts index 9843a9c0476..d25be8aba4b 100644 --- a/src/vs/workbench/test/browser/parts/quickOpen/quickopen.perf.test.ts +++ b/src/vs/workbench/test/browser/parts/quickOpen/quickopen.perf.test.ts @@ -7,7 +7,7 @@ import 'vs/workbench/parts/search/browser/search.contribution'; // load contributions import * as assert from 'assert'; -import {BaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; +import {WorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {createSyncDescriptor} from 'vs/platform/instantiation/common/descriptors'; import {ensureStaticPlatformServices, IEditorOverrideServices} from 'vs/editor/browser/standalone/standaloneServices'; import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService'; @@ -44,14 +44,7 @@ suite('QuickOpen performance', () => { const telemetryService = new TestTelemetryService(); const overrides: IEditorOverrideServices = { - contextService: new BaseWorkspaceContextService({ - resource: URI.file(testWorkspacePath), - id: null, - name: null, - uid: null, - mtime: null - }), - + contextService: new WorkspaceContextService({ resource: URI.file(testWorkspacePath) }), telemetryService }; diff --git a/src/vs/workbench/test/common/memento.test.ts b/src/vs/workbench/test/common/memento.test.ts index 26f480e0880..ec828e011b4 100644 --- a/src/vs/workbench/test/common/memento.test.ts +++ b/src/vs/workbench/test/common/memento.test.ts @@ -6,7 +6,7 @@ 'use strict'; import * as assert from 'assert'; -import {BaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; +import {WorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {StorageScope} from 'vs/platform/storage/common/storage'; import * as TestUtils from 'vs/test/utils/servicesTestUtils'; import {Memento, Scope} from 'vs/workbench/common/memento'; @@ -17,7 +17,7 @@ suite('Workbench Memento', () => { let storage; setup(() => { - context = new BaseWorkspaceContextService(TestUtils.TestWorkspace); + context = new WorkspaceContextService(TestUtils.TestWorkspace); storage = new Storage(new InMemoryLocalStorage(), null, context); });