提交 383086bc 编写于 作者: D Daniel Imms

Remove a bunch of unused code in FileService

上级 ba1bca7f
...@@ -20,7 +20,7 @@ import { FileService } from 'vs/workbench/services/files/node/fileService'; ...@@ -20,7 +20,7 @@ import { FileService } from 'vs/workbench/services/files/node/fileService';
class TestBackupFileService extends BackupFileService { class TestBackupFileService extends BackupFileService {
constructor(workspace: Uri, backupHome: string, workspacesJsonPath: string) { constructor(workspace: Uri, backupHome: string, workspacesJsonPath: string) {
const fileService = new FileService(workspace.fsPath, { disableWatcher: true }, null, null, null); const fileService = new FileService(workspace.fsPath, { disableWatcher: true }, null);
super(workspace, TestEnvironmentService, fileService); super(workspace, TestEnvironmentService, fileService);
this.backupHome = backupHome; this.backupHome = backupHome;
......
...@@ -96,7 +96,7 @@ suite('WorkspaceConfigurationEditingService - Node', () => { ...@@ -96,7 +96,7 @@ suite('WorkspaceConfigurationEditingService - Node', () => {
const configurationService = new WorkspaceConfigurationService(workspaceContextService, new TestEventService(), environmentService); const configurationService = new WorkspaceConfigurationService(workspaceContextService, new TestEventService(), environmentService);
const textFileService = workbenchInstantiationService().createInstance(TestDirtyTextFileService, dirty); const textFileService = workbenchInstantiationService().createInstance(TestDirtyTextFileService, dirty);
const events = new utils.TestEventService(); const events = new utils.TestEventService();
const fileService = new FileService(noWorkspace ? null : workspaceDir, { disableWatcher: true }, events, environmentService, configurationService); const fileService = new FileService(noWorkspace ? null : workspaceDir, { disableWatcher: true }, events);
return configurationService.initialize().then(() => { return configurationService.initialize().then(() => {
return { return {
...@@ -359,7 +359,7 @@ suite('WorkspaceConfigurationEditingService - Node', () => { ...@@ -359,7 +359,7 @@ suite('WorkspaceConfigurationEditingService - Node', () => {
if (error) { if (error) {
return cleanUp(done, error); return cleanUp(done, error);
} }
createServices(workspaceDir, globalSettingsFile).done(services => { createServices(workspaceDir, globalSettingsFile).done(services => {
const target = path.join(workspaceDir, WORKSPACE_STANDALONE_CONFIGURATIONS['launch']); const target = path.join(workspaceDir, WORKSPACE_STANDALONE_CONFIGURATIONS['launch']);
......
...@@ -81,7 +81,7 @@ export class FileService implements IFileService { ...@@ -81,7 +81,7 @@ export class FileService implements IFileService {
// create service // create service
const workspace = this.contextService.getWorkspace(); const workspace = this.contextService.getWorkspace();
this.raw = new NodeFileService(workspace ? workspace.resource.fsPath : void 0, fileServiceConfig, this.eventService, this.environmentService, this.configurationService); this.raw = new NodeFileService(workspace ? workspace.resource.fsPath : void 0, fileServiceConfig, this.eventService);
// Listeners // Listeners
this.registerListeners(); this.registerListeners();
......
...@@ -28,14 +28,10 @@ import pfs = require('vs/base/node/pfs'); ...@@ -28,14 +28,10 @@ import pfs = require('vs/base/node/pfs');
import encoding = require('vs/base/node/encoding'); import encoding = require('vs/base/node/encoding');
import mime = require('vs/base/node/mime'); import mime = require('vs/base/node/mime');
import flow = require('vs/base/node/flow'); import flow = require('vs/base/node/flow');
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { FileWatcher as UnixWatcherService } from 'vs/workbench/services/files/node/watcher/unix/watcherService'; import { FileWatcher as UnixWatcherService } from 'vs/workbench/services/files/node/watcher/unix/watcherService';
import { FileWatcher as WindowsWatcherService } from 'vs/workbench/services/files/node/watcher/win32/watcherService'; import { FileWatcher as WindowsWatcherService } from 'vs/workbench/services/files/node/watcher/win32/watcherService';
import { toFileChangesEvent, normalize, IRawFileChange } from 'vs/workbench/services/files/node/watcher/common'; import { toFileChangesEvent, normalize, IRawFileChange } from 'vs/workbench/services/files/node/watcher/common';
import { IEventService } from 'vs/platform/event/common/event'; import { IEventService } from 'vs/platform/event/common/event';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IFilesConfiguration } from 'vs/platform/files/common/files';
export interface IEncodingOverride { export interface IEncodingOverride {
resource: uri; resource: uri;
...@@ -76,7 +72,6 @@ export class FileService implements IFileService { ...@@ -76,7 +72,6 @@ export class FileService implements IFileService {
private static FS_EVENT_DELAY = 50; // aggregate and only emit events when changes have stopped for this duration (in ms) private static FS_EVENT_DELAY = 50; // aggregate and only emit events when changes have stopped for this duration (in ms)
private static MAX_DEGREE_OF_PARALLEL_FS_OPS = 10; // degree of parallel fs calls that we accept at the same time private static MAX_DEGREE_OF_PARALLEL_FS_OPS = 10; // degree of parallel fs calls that we accept at the same time
private toUnbind: IDisposable[];
private basePath: string; private basePath: string;
private tmpPath: string; private tmpPath: string;
private options: IFileServiceOptions; private options: IFileServiceOptions;
...@@ -87,14 +82,10 @@ export class FileService implements IFileService { ...@@ -87,14 +82,10 @@ export class FileService implements IFileService {
private fileChangesWatchDelayer: ThrottledDelayer<void>; private fileChangesWatchDelayer: ThrottledDelayer<void>;
private undeliveredRawFileChangesEvents: IRawFileChange[]; private undeliveredRawFileChangesEvents: IRawFileChange[];
private configuredHotExit: boolean;
constructor( constructor(
basePath: string, basePath: string,
options: IFileServiceOptions, options: IFileServiceOptions,
private eventEmitter: IEventService, private eventEmitter: IEventService
private environmentService: IEnvironmentService,
private configurationService: IConfigurationService
) { ) {
this.basePath = basePath ? paths.normalize(basePath) : void 0; this.basePath = basePath ? paths.normalize(basePath) : void 0;
...@@ -128,19 +119,6 @@ export class FileService implements IFileService { ...@@ -128,19 +119,6 @@ export class FileService implements IFileService {
this.activeFileChangesWatchers = Object.create(null); this.activeFileChangesWatchers = Object.create(null);
this.fileChangesWatchDelayer = new ThrottledDelayer<void>(FileService.FS_EVENT_DELAY); this.fileChangesWatchDelayer = new ThrottledDelayer<void>(FileService.FS_EVENT_DELAY);
this.undeliveredRawFileChangesEvents = []; this.undeliveredRawFileChangesEvents = [];
// Configuration changes
this.toUnbind = [];
if (this.configurationService) {
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationChange(e.config)));
const configuration = this.configurationService.getConfiguration<IFilesConfiguration>();
this.onConfigurationChange(configuration);
}
}
private onConfigurationChange(configuration: IFilesConfiguration): void {
this.configuredHotExit = configuration && configuration.files && configuration.files.hotExit;
} }
public updateOptions(options: IFileServiceOptions): void { public updateOptions(options: IFileServiceOptions): void {
...@@ -688,8 +666,6 @@ export class FileService implements IFileService { ...@@ -688,8 +666,6 @@ export class FileService implements IFileService {
watcher.close(); watcher.close();
} }
this.activeFileChangesWatchers = Object.create(null); this.activeFileChangesWatchers = Object.create(null);
this.toUnbind = dispose(this.toUnbind);
} }
} }
......
...@@ -38,7 +38,7 @@ suite('FileService', () => { ...@@ -38,7 +38,7 @@ suite('FileService', () => {
} }
events = new utils.TestEventService(); events = new utils.TestEventService();
service = new FileService(testDir, { disableWatcher: true }, events, null, null); service = new FileService(testDir, { disableWatcher: true }, events);
done(); done();
}); });
}); });
...@@ -499,7 +499,7 @@ suite('FileService', () => { ...@@ -499,7 +499,7 @@ suite('FileService', () => {
encoding: 'windows1252', encoding: 'windows1252',
encodingOverride: encodingOverride, encodingOverride: encodingOverride,
disableWatcher: true disableWatcher: true
}, null, null, null); }, null);
_service.resolveContent(uri.file(path.join(testDir, 'index.html'))).done(c => { _service.resolveContent(uri.file(path.join(testDir, 'index.html'))).done(c => {
assert.equal(c.encoding, 'windows1252'); assert.equal(c.encoding, 'windows1252');
...@@ -525,7 +525,7 @@ suite('FileService', () => { ...@@ -525,7 +525,7 @@ suite('FileService', () => {
let _service = new FileService(_testDir, { let _service = new FileService(_testDir, {
disableWatcher: true disableWatcher: true
}, null, null, null); }, null);
extfs.copy(_sourceDir, _testDir, () => { extfs.copy(_sourceDir, _testDir, () => {
fs.readFile(resource.fsPath, (error, data) => { fs.readFile(resource.fsPath, (error, data) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册