From 9f0e79e957c851a017df250674685e9eae8dcca8 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 3 Apr 2019 16:28:03 +0200 Subject: [PATCH] file service => legacy file service --- .../electron-browser/extensionsTipsService.test.ts | 4 ++-- .../electron-browser/backupFileService.test.ts | 4 ++-- .../configurationEditingService.test.ts | 4 ++-- .../electron-browser/configurationService.test.ts | 10 +++++----- .../workbench/services/files/node/fileService.ts | 2 +- .../services/files/node/remoteFileService.ts | 12 ++++++------ .../test/electron-browser/fileService.test.ts | 14 +++++++------- .../electron-browser/keybindingEditing.test.ts | 4 ++-- .../services/output/common/outputChannelModel.ts | 1 + 9 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsTipsService.test.ts b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsTipsService.test.ts index 7c8a7cc2075..0084ade5ccf 100644 --- a/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsTipsService.test.ts +++ b/src/vs/workbench/contrib/extensions/test/electron-browser/extensionsTipsService.test.ts @@ -26,7 +26,7 @@ import { TestNotificationService } from 'vs/platform/notification/test/common/te import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { URI } from 'vs/base/common/uri'; import { testWorkspace } from 'vs/platform/workspace/test/common/testWorkspace'; -import { FileService } from 'vs/workbench/services/files/node/fileService'; +import { LegacyFileService } from 'vs/workbench/services/files/node/fileService'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { IPager } from 'vs/base/common/paging'; import { assign } from 'vs/base/common/objects'; @@ -285,7 +285,7 @@ suite('ExtensionsTipsService Test', () => { instantiationService.stub(IWorkspaceContextService, workspaceService); const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - fileService.setLegacyService(new FileService( + fileService.setLegacyService(new LegacyFileService( fileService, workspaceService, TestEnvironmentService, diff --git a/src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts b/src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts index 93be6904c0d..371d7fd0dfa 100644 --- a/src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts +++ b/src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts @@ -12,7 +12,7 @@ import * as path from 'vs/base/common/path'; import * as pfs from 'vs/base/node/pfs'; import { URI as Uri } from 'vs/base/common/uri'; import { BackupFileService, BackupFilesModel, hashPath } from 'vs/workbench/services/backup/node/backupFileService'; -import { FileService } from 'vs/workbench/services/files/node/fileService'; +import { LegacyFileService } from 'vs/workbench/services/files/node/fileService'; import { TextModel, createTextBufferFactory } from 'vs/editor/common/model/textModel'; import { TestContextService, TestTextResourceConfigurationService, TestEnvironmentService, TestWindowService } from 'vs/workbench/test/workbenchTestServices'; import { getRandomTestPath } from 'vs/base/test/node/testUtils'; @@ -58,7 +58,7 @@ class TestBackupFileService extends BackupFileService { constructor(workspace: Uri, backupHome: string, workspacesJsonPath: string) { const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - fileService.setLegacyService(new FileService( + fileService.setLegacyService(new LegacyFileService( fileService, new TestContextService(new Workspace(workspace.fsPath, toWorkspaceFolders([{ path: workspace.fsPath }]))), TestEnvironmentService, diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts index fd81c6bf024..8c23058f244 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts @@ -18,7 +18,7 @@ import { TestTextFileService, TestTextResourceConfigurationService, workbenchIns import * as uuid from 'vs/base/common/uuid'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; import { WorkspaceService } from 'vs/workbench/services/configuration/node/configurationService'; -import { FileService } from 'vs/workbench/services/files/node/fileService'; +import { LegacyFileService } from 'vs/workbench/services/files/node/fileService'; import { ConfigurationEditingService, ConfigurationEditingError, ConfigurationEditingErrorCode } from 'vs/workbench/services/configuration/common/configurationEditingService'; import { WORKSPACE_STANDALONE_CONFIGURATIONS } from 'vs/workbench/services/configuration/common/configuration'; import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; @@ -112,7 +112,7 @@ suite('ConfigurationEditingService', () => { instantiationService.stub(IConfigurationService, workspaceService); const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - fileService.setLegacyService(new FileService( + fileService.setLegacyService(new LegacyFileService( fileService, workspaceService, TestEnvironmentService, diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index aa7c9bca598..75873ce4f23 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -23,7 +23,7 @@ import { IFileService, FileChangesEvent, FileChangeType } from 'vs/platform/file import { IWorkspaceContextService, WorkbenchState, IWorkspaceFoldersChangeEvent } from 'vs/platform/workspace/common/workspace'; import { ConfigurationTarget, IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; import { workbenchInstantiationService, TestTextResourceConfigurationService, TestTextFileService, TestEnvironmentService } from 'vs/workbench/test/workbenchTestServices'; -import { FileService } from 'vs/workbench/services/files/node/fileService'; +import { LegacyFileService } from 'vs/workbench/services/files/node/fileService'; import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; @@ -230,7 +230,7 @@ suite('WorkspaceContextService - Workspace Editing', () => { return workspaceService.initialize(getWorkspaceIdentifier(configPath)).then(() => { const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - fileService.setLegacyService(new FileService( + fileService.setLegacyService(new LegacyFileService( fileService, workspaceService, TestEnvironmentService, @@ -499,7 +499,7 @@ suite('WorkspaceService - Initialization', () => { return workspaceService.initialize({ id: '' }).then(() => { const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - fileService.setLegacyService(new FileService( + fileService.setLegacyService(new LegacyFileService( fileService, workspaceService, TestEnvironmentService, @@ -763,7 +763,7 @@ suite('WorkspaceConfigurationService - Folder', () => { return workspaceService.initialize(convertToWorkspacePayload(URI.file(folderDir))).then(() => { const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - fileService.setLegacyService(new FileService( + fileService.setLegacyService(new LegacyFileService( fileService, workspaceService, TestEnvironmentService, @@ -1061,7 +1061,7 @@ suite('WorkspaceConfigurationService-Multiroot', () => { return workspaceService.initialize(getWorkspaceIdentifier(configPath)).then(() => { const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - fileService.setLegacyService(new FileService( + fileService.setLegacyService(new LegacyFileService( fileService, workspaceService, TestEnvironmentService, diff --git a/src/vs/workbench/services/files/node/fileService.ts b/src/vs/workbench/services/files/node/fileService.ts index 459c88425ec..d456253481c 100644 --- a/src/vs/workbench/services/files/node/fileService.ts +++ b/src/vs/workbench/services/files/node/fileService.ts @@ -33,7 +33,7 @@ export interface IFileServiceTestOptions { encodingOverride?: IEncodingOverride[]; } -export class FileService extends Disposable implements ILegacyFileService { +export class LegacyFileService extends Disposable implements ILegacyFileService { _serviceBrand: any; diff --git a/src/vs/workbench/services/files/node/remoteFileService.ts b/src/vs/workbench/services/files/node/remoteFileService.ts index 54768549bab..66164e84edd 100644 --- a/src/vs/workbench/services/files/node/remoteFileService.ts +++ b/src/vs/workbench/services/files/node/remoteFileService.ts @@ -13,11 +13,11 @@ import { localize } from 'vs/nls'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { FileOperation, FileOperationError, FileOperationEvent, FileOperationResult, FileWriteOptions, FileSystemProviderCapabilities, IContent, ICreateFileOptions, IFileSystemProvider, IResolveContentOptions, IStreamContent, ITextSnapshot, IUpdateContentOptions, StringSnapshot, ILegacyFileService, IFileService, toFileOperationResult, IFileStatWithMetadata } from 'vs/platform/files/common/files'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; -import { FileService } from 'vs/workbench/services/files/node/fileService'; +import { LegacyFileService } from 'vs/workbench/services/files/node/fileService'; import { createReadableOfProvider, createReadableOfSnapshot, createWritableOfProvider } from 'vs/workbench/services/files/node/streams'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -export class RemoteFileService extends FileService { +export class LegacyRemoteFileService extends LegacyFileService { private readonly _provider: Map; @@ -81,7 +81,7 @@ export class RemoteFileService extends FileService { if (resource.scheme === Schemas.file) { return super.resolveContent(resource, options); } else { - return this._readFile(resource, options).then(RemoteFileService._asContent); + return this._readFile(resource, options).then(LegacyRemoteFileService._asContent); } } @@ -163,7 +163,7 @@ export class RemoteFileService extends FileService { return super.createFile(resource, content, options); } else { - return this._withProvider(resource).then(RemoteFileService._throwIfFileSystemIsReadonly).then(provider => { + return this._withProvider(resource).then(LegacyRemoteFileService._throwIfFileSystemIsReadonly).then(provider => { return this.fileService.createFolder(resources.dirname(resource)).then(() => { const { encoding } = this.encoding.getWriteEncoding(resource); @@ -185,7 +185,7 @@ export class RemoteFileService extends FileService { if (resource.scheme === Schemas.file) { return super.updateContent(resource, value, options); } else { - return this._withProvider(resource).then(RemoteFileService._throwIfFileSystemIsReadonly).then(provider => { + return this._withProvider(resource).then(LegacyRemoteFileService._throwIfFileSystemIsReadonly).then(provider => { return this.fileService.createFolder(resources.dirname(resource)).then(() => { const snapshot = typeof value === 'string' ? new StringSnapshot(value) : value; return this._writeFile(provider, resource, snapshot, options && options.encoding, { create: true, overwrite: true }); @@ -227,4 +227,4 @@ export class RemoteFileService extends FileService { } } -registerSingleton(ILegacyFileService, RemoteFileService); \ No newline at end of file +registerSingleton(ILegacyFileService, LegacyRemoteFileService); \ No newline at end of file diff --git a/src/vs/workbench/services/files/test/electron-browser/fileService.test.ts b/src/vs/workbench/services/files/test/electron-browser/fileService.test.ts index 39042a7a84a..99268432238 100644 --- a/src/vs/workbench/services/files/test/electron-browser/fileService.test.ts +++ b/src/vs/workbench/services/files/test/electron-browser/fileService.test.ts @@ -7,7 +7,7 @@ import * as fs from 'fs'; import * as path from 'vs/base/common/path'; import * as os from 'os'; import * as assert from 'assert'; -import { FileService } from 'vs/workbench/services/files/node/fileService'; +import { LegacyFileService } from 'vs/workbench/services/files/node/fileService'; import { FileOperation, FileOperationEvent, FileOperationResult, FileOperationError } from 'vs/platform/files/common/files'; import { URI as uri } from 'vs/base/common/uri'; import * as uuid from 'vs/base/common/uuid'; @@ -25,8 +25,8 @@ import { NullLogService } from 'vs/platform/log/common/log'; import { Schemas } from 'vs/base/common/network'; import { DiskFileSystemProvider } from 'vs/workbench/services/files2/node/diskFileSystemProvider'; -suite('FileService', () => { - let service: FileService; +suite('LegacyFileService', () => { + let service: LegacyFileService; const parentDir = getRandomTestPath(os.tmpdir(), 'vsctests', 'fileservice'); let testDir: string; @@ -39,7 +39,7 @@ suite('FileService', () => { fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); return pfs.copy(sourceDir, testDir).then(() => { - service = new FileService( + service = new LegacyFileService( fileService, new TestContextService(new Workspace(testDir, toWorkspaceFolders([{ path: testDir }]))), TestEnvironmentService, @@ -382,7 +382,7 @@ suite('FileService', () => { fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - const _service = new FileService( + const _service = new LegacyFileService( fileService, new TestContextService(new Workspace(_testDir, toWorkspaceFolders([{ path: _testDir }]))), TestEnvironmentService, @@ -424,7 +424,7 @@ suite('FileService', () => { const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - const _service = new FileService( + const _service = new LegacyFileService( fileService, new TestContextService(new Workspace(_testDir, toWorkspaceFolders([{ path: _testDir }]))), TestEnvironmentService, @@ -455,7 +455,7 @@ suite('FileService', () => { const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - const _service = new FileService( + const _service = new LegacyFileService( fileService, new TestContextService(new Workspace(_testDir, toWorkspaceFolders([{ path: _testDir }]))), TestEnvironmentService, diff --git a/src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts b/src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts index d61541bf28c..81b9251db5c 100644 --- a/src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts +++ b/src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts @@ -35,7 +35,7 @@ import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtil import { IWorkspaceContextService, Workspace, toWorkspaceFolders } from 'vs/platform/workspace/common/workspace'; import { IBackupFileService } from 'vs/workbench/services/backup/common/backup'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { FileService } from 'vs/workbench/services/files/node/fileService'; +import { LegacyFileService } from 'vs/workbench/services/files/node/fileService'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { KeybindingsEditingService } from 'vs/workbench/services/keybinding/common/keybindingEditing'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; @@ -84,7 +84,7 @@ suite('KeybindingsEditing', () => { instantiationService.stub(IModelService, instantiationService.createInstance(ModelServiceImpl)); const fileService = new FileService2(new NullLogService()); fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(new NullLogService())); - fileService.setLegacyService(new FileService( + fileService.setLegacyService(new LegacyFileService( fileService, new TestContextService(new Workspace(testDir, toWorkspaceFolders([{ path: testDir }]))), TestEnvironmentService, diff --git a/src/vs/workbench/services/output/common/outputChannelModel.ts b/src/vs/workbench/services/output/common/outputChannelModel.ts index 2a138949beb..9f8f84fe8bb 100644 --- a/src/vs/workbench/services/output/common/outputChannelModel.ts +++ b/src/vs/workbench/services/output/common/outputChannelModel.ts @@ -129,6 +129,7 @@ export abstract class AbstractFileOutputChannelModel extends Disposable implemen } } +// TODO@ben see if new watchers can cope with spdlog and avoid polling then class OutputFileListener extends Disposable { private readonly _onDidContentChange = new Emitter(); -- GitLab