提交 9f0e79e9 编写于 作者: B Benjamin Pasero

file service => legacy file service

上级 8104e9f0
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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;
......
......@@ -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<string, IFileSystemProvider>;
......@@ -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
......@@ -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,
......
......@@ -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,
......
......@@ -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<number | undefined>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册