提交 954d03fd 编写于 作者: B Benjamin Pasero

files - rename events to follow conventions

上级 92df7a03
...@@ -352,7 +352,7 @@ export class UserSettings extends Disposable { ...@@ -352,7 +352,7 @@ export class UserSettings extends Disposable {
super(); super();
this.parser = new ConfigurationModelParser(this.userSettingsResource.toString(), this.scopes); this.parser = new ConfigurationModelParser(this.userSettingsResource.toString(), this.scopes);
this._register(this.fileService.watch(dirname(this.userSettingsResource))); this._register(this.fileService.watch(dirname(this.userSettingsResource)));
this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(this.userSettingsResource))(() => this._onDidChange.fire())); this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.userSettingsResource))(() => this._onDidChange.fire()));
} }
async loadConfiguration(): Promise<ConfigurationModel> { async loadConfiguration(): Promise<ConfigurationModel> {
......
...@@ -55,7 +55,7 @@ export class FileService extends Disposable implements IFileService { ...@@ -55,7 +55,7 @@ export class FileService extends Disposable implements IFileService {
// Forward events from provider // Forward events from provider
const providerDisposables = new DisposableStore(); const providerDisposables = new DisposableStore();
providerDisposables.add(provider.onDidChangeFile(changes => this._onFileChanges.fire(new FileChangesEvent(changes)))); providerDisposables.add(provider.onDidChangeFile(changes => this._onDidFilesChange.fire(new FileChangesEvent(changes))));
providerDisposables.add(provider.onDidChangeCapabilities(() => this._onDidChangeFileSystemProviderCapabilities.fire({ provider, scheme }))); providerDisposables.add(provider.onDidChangeCapabilities(() => this._onDidChangeFileSystemProviderCapabilities.fire({ provider, scheme })));
if (typeof provider.onDidErrorOccur === 'function') { if (typeof provider.onDidErrorOccur === 'function') {
providerDisposables.add(provider.onDidErrorOccur(error => this._onError.fire(new Error(error)))); providerDisposables.add(provider.onDidErrorOccur(error => this._onError.fire(new Error(error))));
...@@ -147,11 +147,11 @@ export class FileService extends Disposable implements IFileService { ...@@ -147,11 +147,11 @@ export class FileService extends Disposable implements IFileService {
//#endregion //#endregion
private _onAfterOperation: Emitter<FileOperationEvent> = this._register(new Emitter<FileOperationEvent>()); private _onDidRunOperation = this._register(new Emitter<FileOperationEvent>());
readonly onAfterOperation: Event<FileOperationEvent> = this._onAfterOperation.event; readonly onDidRunOperation = this._onDidRunOperation.event;
private _onError: Emitter<Error> = this._register(new Emitter<Error>()); private _onError = this._register(new Emitter<Error>());
readonly onError: Event<Error> = this._onError.event; readonly onError = this._onError.event;
//#region File Metadata Resolving //#region File Metadata Resolving
...@@ -299,7 +299,7 @@ export class FileService extends Disposable implements IFileService { ...@@ -299,7 +299,7 @@ export class FileService extends Disposable implements IFileService {
const fileStat = await this.writeFile(resource, bufferOrReadableOrStream); const fileStat = await this.writeFile(resource, bufferOrReadableOrStream);
// events // events
this._onAfterOperation.fire(new FileOperationEvent(resource, FileOperation.CREATE, fileStat)); this._onDidRunOperation.fire(new FileOperationEvent(resource, FileOperation.CREATE, fileStat));
return fileStat; return fileStat;
} }
...@@ -549,7 +549,7 @@ export class FileService extends Disposable implements IFileService { ...@@ -549,7 +549,7 @@ export class FileService extends Disposable implements IFileService {
// resolve and send events // resolve and send events
const fileStat = await this.resolve(target, { resolveMetadata: true }); const fileStat = await this.resolve(target, { resolveMetadata: true });
this._onAfterOperation.fire(new FileOperationEvent(source, mode === 'move' ? FileOperation.MOVE : FileOperation.COPY, fileStat)); this._onDidRunOperation.fire(new FileOperationEvent(source, mode === 'move' ? FileOperation.MOVE : FileOperation.COPY, fileStat));
return fileStat; return fileStat;
} }
...@@ -563,7 +563,7 @@ export class FileService extends Disposable implements IFileService { ...@@ -563,7 +563,7 @@ export class FileService extends Disposable implements IFileService {
// resolve and send events // resolve and send events
const fileStat = await this.resolve(target, { resolveMetadata: true }); const fileStat = await this.resolve(target, { resolveMetadata: true });
this._onAfterOperation.fire(new FileOperationEvent(source, mode === 'copy' ? FileOperation.COPY : FileOperation.MOVE, fileStat)); this._onDidRunOperation.fire(new FileOperationEvent(source, mode === 'copy' ? FileOperation.COPY : FileOperation.MOVE, fileStat));
return fileStat; return fileStat;
} }
...@@ -717,7 +717,7 @@ export class FileService extends Disposable implements IFileService { ...@@ -717,7 +717,7 @@ export class FileService extends Disposable implements IFileService {
// events // events
const fileStat = await this.resolve(resource, { resolveMetadata: true }); const fileStat = await this.resolve(resource, { resolveMetadata: true });
this._onAfterOperation.fire(new FileOperationEvent(resource, FileOperation.CREATE, fileStat)); this._onDidRunOperation.fire(new FileOperationEvent(resource, FileOperation.CREATE, fileStat));
return fileStat; return fileStat;
} }
...@@ -799,15 +799,15 @@ export class FileService extends Disposable implements IFileService { ...@@ -799,15 +799,15 @@ export class FileService extends Disposable implements IFileService {
await provider.delete(resource, { recursive, useTrash }); await provider.delete(resource, { recursive, useTrash });
// Events // Events
this._onAfterOperation.fire(new FileOperationEvent(resource, FileOperation.DELETE)); this._onDidRunOperation.fire(new FileOperationEvent(resource, FileOperation.DELETE));
} }
//#endregion //#endregion
//#region File Watching //#region File Watching
private _onFileChanges: Emitter<FileChangesEvent> = this._register(new Emitter<FileChangesEvent>()); private _onDidFilesChange = this._register(new Emitter<FileChangesEvent>());
readonly onFileChanges: Event<FileChangesEvent> = this._onFileChanges.event; readonly onDidFilesChange = this._onDidFilesChange.event;
private activeWatchers = new Map<string, { disposable: IDisposable, count: number }>(); private activeWatchers = new Map<string, { disposable: IDisposable, count: number }>();
......
...@@ -63,12 +63,12 @@ export interface IFileService { ...@@ -63,12 +63,12 @@ export interface IFileService {
* Allows to listen for file changes. The event will fire for every file within the opened workspace * Allows to listen for file changes. The event will fire for every file within the opened workspace
* (if any) as well as all files that have been watched explicitly using the #watch() API. * (if any) as well as all files that have been watched explicitly using the #watch() API.
*/ */
readonly onFileChanges: Event<FileChangesEvent>; readonly onDidFilesChange: Event<FileChangesEvent>;
/** /**
* An event that is fired upon successful completion of a certain file operation. * An event that is fired upon successful completion of a certain file operation.
*/ */
readonly onAfterOperation: Event<FileOperationEvent>; readonly onDidRunOperation: Event<FileOperationEvent>;
/** /**
* Resolve the properties of a file/folder identified by the resource. * Resolve the properties of a file/folder identified by the resource.
...@@ -471,15 +471,7 @@ export interface IFileChange { ...@@ -471,15 +471,7 @@ export interface IFileChange {
export class FileChangesEvent { export class FileChangesEvent {
private readonly _changes: readonly IFileChange[]; constructor(public readonly changes: readonly IFileChange[]) { }
constructor(changes: readonly IFileChange[]) {
this._changes = changes;
}
get changes() {
return this._changes;
}
/** /**
* Returns true if this change event contains the provided file with the given change type (if provided). In case of * Returns true if this change event contains the provided file with the given change type (if provided). In case of
...@@ -493,7 +485,7 @@ export class FileChangesEvent { ...@@ -493,7 +485,7 @@ export class FileChangesEvent {
const checkForChangeType = !isUndefinedOrNull(type); const checkForChangeType = !isUndefinedOrNull(type);
return this._changes.some(change => { return this.changes.some(change => {
if (checkForChangeType && change.type !== type) { if (checkForChangeType && change.type !== type) {
return false; return false;
} }
...@@ -550,11 +542,11 @@ export class FileChangesEvent { ...@@ -550,11 +542,11 @@ export class FileChangesEvent {
} }
private getOfType(type: FileChangeType): IFileChange[] { private getOfType(type: FileChangeType): IFileChange[] {
return this._changes.filter(change => change.type === type); return this.changes.filter(change => change.type === type);
} }
private hasType(type: FileChangeType): boolean { private hasType(type: FileChangeType): boolean {
return this._changes.some(change => { return this.changes.some(change => {
return change.type === type; return change.type === type;
}); });
} }
......
...@@ -20,7 +20,7 @@ export class FileWatcher extends Disposable { ...@@ -20,7 +20,7 @@ export class FileWatcher extends Disposable {
constructor( constructor(
private path: string, private path: string,
private onFileChanges: (changes: IDiskFileChange[]) => void, private onDidFilesChange: (changes: IDiskFileChange[]) => void,
private onLogMessage: (msg: ILogMessage) => void, private onLogMessage: (msg: ILogMessage) => void,
private verboseLogging: boolean private verboseLogging: boolean
) { ) {
...@@ -101,7 +101,7 @@ export class FileWatcher extends Disposable { ...@@ -101,7 +101,7 @@ export class FileWatcher extends Disposable {
// Fire // Fire
if (normalizedFileChanges.length > 0) { if (normalizedFileChanges.length > 0) {
this.onFileChanges(normalizedFileChanges); this.onDidFilesChange(normalizedFileChanges);
} }
return Promise.resolve(); return Promise.resolve();
......
...@@ -21,7 +21,7 @@ export class FileWatcher extends Disposable { ...@@ -21,7 +21,7 @@ export class FileWatcher extends Disposable {
constructor( constructor(
private folders: IWatcherRequest[], private folders: IWatcherRequest[],
private onFileChanges: (changes: IDiskFileChange[]) => void, private onDidFilesChange: (changes: IDiskFileChange[]) => void,
private onLogMessage: (msg: ILogMessage) => void, private onLogMessage: (msg: ILogMessage) => void,
private verboseLogging: boolean, private verboseLogging: boolean,
) { ) {
...@@ -68,7 +68,7 @@ export class FileWatcher extends Disposable { ...@@ -68,7 +68,7 @@ export class FileWatcher extends Disposable {
this.service.setVerboseLogging(this.verboseLogging); this.service.setVerboseLogging(this.verboseLogging);
const options = {}; const options = {};
this._register(this.service.watch(options)(e => !this.isDisposed && this.onFileChanges(e))); this._register(this.service.watch(options)(e => !this.isDisposed && this.onDidFilesChange(e)));
this._register(this.service.onLogMessage(m => this.onLogMessage(m))); this._register(this.service.onLogMessage(m => this.onLogMessage(m)));
......
...@@ -20,7 +20,7 @@ export class FileWatcher extends Disposable { ...@@ -20,7 +20,7 @@ export class FileWatcher extends Disposable {
constructor( constructor(
private folders: IWatcherRequest[], private folders: IWatcherRequest[],
private onFileChanges: (changes: IDiskFileChange[]) => void, private onDidFilesChange: (changes: IDiskFileChange[]) => void,
private onLogMessage: (msg: ILogMessage) => void, private onLogMessage: (msg: ILogMessage) => void,
private verboseLogging: boolean, private verboseLogging: boolean,
private watcherOptions: IWatcherOptions = {} private watcherOptions: IWatcherOptions = {}
...@@ -67,7 +67,7 @@ export class FileWatcher extends Disposable { ...@@ -67,7 +67,7 @@ export class FileWatcher extends Disposable {
this.service.setVerboseLogging(this.verboseLogging); this.service.setVerboseLogging(this.verboseLogging);
this._register(this.service.watch(this.watcherOptions)(e => !this.isDisposed && this.onFileChanges(e))); this._register(this.service.watch(this.watcherOptions)(e => !this.isDisposed && this.onDidFilesChange(e)));
this._register(this.service.onLogMessage(m => this.onLogMessage(m))); this._register(this.service.onLogMessage(m => this.onLogMessage(m)));
......
...@@ -16,7 +16,7 @@ export class FileWatcher implements IDisposable { ...@@ -16,7 +16,7 @@ export class FileWatcher implements IDisposable {
constructor( constructor(
folders: { path: string, excludes: string[] }[], folders: { path: string, excludes: string[] }[],
private onFileChanges: (changes: IDiskFileChange[]) => void, private onDidFilesChange: (changes: IDiskFileChange[]) => void,
private onLogMessage: (msg: ILogMessage) => void, private onLogMessage: (msg: ILogMessage) => void,
private verboseLogging: boolean private verboseLogging: boolean
) { ) {
...@@ -62,7 +62,7 @@ export class FileWatcher implements IDisposable { ...@@ -62,7 +62,7 @@ export class FileWatcher implements IDisposable {
// Emit through event emitter // Emit through event emitter
if (events.length > 0) { if (events.length > 0) {
this.onFileChanges(events); this.onDidFilesChange(events);
} }
} }
......
...@@ -165,7 +165,7 @@ suite('Disk File Service', function () { ...@@ -165,7 +165,7 @@ suite('Disk File Service', function () {
test('createFolder', async () => { test('createFolder', async () => {
let event: FileOperationEvent | undefined; let event: FileOperationEvent | undefined;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const parent = await service.resolve(URI.file(testDir)); const parent = await service.resolve(URI.file(testDir));
...@@ -185,7 +185,7 @@ suite('Disk File Service', function () { ...@@ -185,7 +185,7 @@ suite('Disk File Service', function () {
test('createFolder: creating multiple folders at once', async () => { test('createFolder: creating multiple folders at once', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const multiFolderPaths = ['a', 'couple', 'of', 'folders']; const multiFolderPaths = ['a', 'couple', 'of', 'folders'];
const parent = await service.resolve(URI.file(testDir)); const parent = await service.resolve(URI.file(testDir));
...@@ -460,7 +460,7 @@ suite('Disk File Service', function () { ...@@ -460,7 +460,7 @@ suite('Disk File Service', function () {
test('deleteFile', async () => { test('deleteFile', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const resource = URI.file(join(testDir, 'deep', 'conway.js')); const resource = URI.file(join(testDir, 'deep', 'conway.js'));
const source = await service.resolve(resource); const source = await service.resolve(resource);
...@@ -496,7 +496,7 @@ suite('Disk File Service', function () { ...@@ -496,7 +496,7 @@ suite('Disk File Service', function () {
const source = await service.resolve(link); const source = await service.resolve(link);
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
await service.del(source.resource); await service.del(source.resource);
...@@ -519,7 +519,7 @@ suite('Disk File Service', function () { ...@@ -519,7 +519,7 @@ suite('Disk File Service', function () {
await symlink(target.fsPath, link.fsPath); await symlink(target.fsPath, link.fsPath);
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
await service.del(link); await service.del(link);
...@@ -532,7 +532,7 @@ suite('Disk File Service', function () { ...@@ -532,7 +532,7 @@ suite('Disk File Service', function () {
test('deleteFolder (recursive)', async () => { test('deleteFolder (recursive)', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const resource = URI.file(join(testDir, 'deep')); const resource = URI.file(join(testDir, 'deep'));
const source = await service.resolve(resource); const source = await service.resolve(resource);
...@@ -561,7 +561,7 @@ suite('Disk File Service', function () { ...@@ -561,7 +561,7 @@ suite('Disk File Service', function () {
test('move', async () => { test('move', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = URI.file(join(testDir, 'index.html')); const source = URI.file(join(testDir, 'index.html'));
const sourceContents = readFileSync(source.fsPath); const sourceContents = readFileSync(source.fsPath);
...@@ -641,7 +641,7 @@ suite('Disk File Service', function () { ...@@ -641,7 +641,7 @@ suite('Disk File Service', function () {
async function testMoveAcrossProviders(sourceFile = 'index.html'): Promise<void> { async function testMoveAcrossProviders(sourceFile = 'index.html'): Promise<void> {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = URI.file(join(testDir, sourceFile)); const source = URI.file(join(testDir, sourceFile));
const sourceContents = readFileSync(source.fsPath); const sourceContents = readFileSync(source.fsPath);
...@@ -665,7 +665,7 @@ suite('Disk File Service', function () { ...@@ -665,7 +665,7 @@ suite('Disk File Service', function () {
test('move - multi folder', async () => { test('move - multi folder', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const multiFolderPaths = ['a', 'couple', 'of', 'folders']; const multiFolderPaths = ['a', 'couple', 'of', 'folders'];
const renameToPath = join(...multiFolderPaths, 'other.html'); const renameToPath = join(...multiFolderPaths, 'other.html');
...@@ -684,7 +684,7 @@ suite('Disk File Service', function () { ...@@ -684,7 +684,7 @@ suite('Disk File Service', function () {
test('move - directory', async () => { test('move - directory', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = URI.file(join(testDir, 'deep')); const source = URI.file(join(testDir, 'deep'));
...@@ -728,7 +728,7 @@ suite('Disk File Service', function () { ...@@ -728,7 +728,7 @@ suite('Disk File Service', function () {
async function testMoveFolderAcrossProviders(): Promise<void> { async function testMoveFolderAcrossProviders(): Promise<void> {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = URI.file(join(testDir, 'deep')); const source = URI.file(join(testDir, 'deep'));
const sourceChildren = readdirSync(source.fsPath); const sourceChildren = readdirSync(source.fsPath);
...@@ -753,7 +753,7 @@ suite('Disk File Service', function () { ...@@ -753,7 +753,7 @@ suite('Disk File Service', function () {
test('move - MIX CASE', async () => { test('move - MIX CASE', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true }); const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true });
assert.ok(source.size > 0); assert.ok(source.size > 0);
...@@ -774,7 +774,7 @@ suite('Disk File Service', function () { ...@@ -774,7 +774,7 @@ suite('Disk File Service', function () {
test('move - same file', async () => { test('move - same file', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true }); const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true });
assert.ok(source.size > 0); assert.ok(source.size > 0);
...@@ -794,7 +794,7 @@ suite('Disk File Service', function () { ...@@ -794,7 +794,7 @@ suite('Disk File Service', function () {
test('move - same file #2', async () => { test('move - same file #2', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true }); const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true });
assert.ok(source.size > 0); assert.ok(source.size > 0);
...@@ -817,7 +817,7 @@ suite('Disk File Service', function () { ...@@ -817,7 +817,7 @@ suite('Disk File Service', function () {
test('move - source parent of target', async () => { test('move - source parent of target', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
let source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true }); let source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true });
const originalSize = source.size; const originalSize = source.size;
...@@ -839,7 +839,7 @@ suite('Disk File Service', function () { ...@@ -839,7 +839,7 @@ suite('Disk File Service', function () {
test('move - FILE_MOVE_CONFLICT', async () => { test('move - FILE_MOVE_CONFLICT', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
let source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true }); let source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true });
const originalSize = source.size; const originalSize = source.size;
...@@ -863,7 +863,7 @@ suite('Disk File Service', function () { ...@@ -863,7 +863,7 @@ suite('Disk File Service', function () {
let createEvent: FileOperationEvent; let createEvent: FileOperationEvent;
let moveEvent: FileOperationEvent; let moveEvent: FileOperationEvent;
let deleteEvent: FileOperationEvent; let deleteEvent: FileOperationEvent;
disposables.add(service.onAfterOperation(e => { disposables.add(service.onDidRunOperation(e => {
if (e.operation === FileOperation.CREATE) { if (e.operation === FileOperation.CREATE) {
createEvent = e; createEvent = e;
} else if (e.operation === FileOperation.DELETE) { } else if (e.operation === FileOperation.DELETE) {
...@@ -927,7 +927,7 @@ suite('Disk File Service', function () { ...@@ -927,7 +927,7 @@ suite('Disk File Service', function () {
async function doTestCopy(sourceName: string = 'index.html') { async function doTestCopy(sourceName: string = 'index.html') {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = await service.resolve(URI.file(join(testDir, sourceName))); const source = await service.resolve(URI.file(join(testDir, sourceName)));
const target = URI.file(join(testDir, 'other.html')); const target = URI.file(join(testDir, 'other.html'));
...@@ -952,7 +952,7 @@ suite('Disk File Service', function () { ...@@ -952,7 +952,7 @@ suite('Disk File Service', function () {
let createEvent: FileOperationEvent; let createEvent: FileOperationEvent;
let copyEvent: FileOperationEvent; let copyEvent: FileOperationEvent;
let deleteEvent: FileOperationEvent; let deleteEvent: FileOperationEvent;
disposables.add(service.onAfterOperation(e => { disposables.add(service.onDidRunOperation(e => {
if (e.operation === FileOperation.CREATE) { if (e.operation === FileOperation.CREATE) {
createEvent = e; createEvent = e;
} else if (e.operation === FileOperation.DELETE) { } else if (e.operation === FileOperation.DELETE) {
...@@ -1057,7 +1057,7 @@ suite('Disk File Service', function () { ...@@ -1057,7 +1057,7 @@ suite('Disk File Service', function () {
test('copy - same file', async () => { test('copy - same file', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true }); const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true });
assert.ok(source.size > 0); assert.ok(source.size > 0);
...@@ -1077,7 +1077,7 @@ suite('Disk File Service', function () { ...@@ -1077,7 +1077,7 @@ suite('Disk File Service', function () {
test('copy - same file #2', async () => { test('copy - same file #2', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true }); const source = await service.resolve(URI.file(join(testDir, 'index.html')), { resolveMetadata: true });
assert.ok(source.size > 0); assert.ok(source.size > 0);
...@@ -1567,7 +1567,7 @@ suite('Disk File Service', function () { ...@@ -1567,7 +1567,7 @@ suite('Disk File Service', function () {
async function assertCreateFile(converter: (content: string) => VSBuffer | VSBufferReadable | VSBufferReadableStream): Promise<void> { async function assertCreateFile(converter: (content: string) => VSBuffer | VSBufferReadable | VSBufferReadableStream): Promise<void> {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const contents = 'Hello World'; const contents = 'Hello World';
const resource = URI.file(join(testDir, 'test.txt')); const resource = URI.file(join(testDir, 'test.txt'));
...@@ -1600,7 +1600,7 @@ suite('Disk File Service', function () { ...@@ -1600,7 +1600,7 @@ suite('Disk File Service', function () {
test('createFile (allows to overwrite existing)', async () => { test('createFile (allows to overwrite existing)', async () => {
let event: FileOperationEvent; let event: FileOperationEvent;
disposables.add(service.onAfterOperation(e => event = e)); disposables.add(service.onDidRunOperation(e => event = e));
const contents = 'Hello World'; const contents = 'Hello World';
const resource = URI.file(join(testDir, 'test.txt')); const resource = URI.file(join(testDir, 'test.txt'));
...@@ -2152,7 +2152,7 @@ suite('Disk File Service', function () { ...@@ -2152,7 +2152,7 @@ suite('Disk File Service', function () {
return event.changes.map(change => `Change: type ${toString(change.type)} path ${change.resource.toString()}`).join('\n'); return event.changes.map(change => `Change: type ${toString(change.type)} path ${change.resource.toString()}`).join('\n');
} }
const listenerDisposable = service.onFileChanges(event => { const listenerDisposable = service.onDidFilesChange(event => {
watcherDisposable.dispose(); watcherDisposable.dispose();
listenerDisposable.dispose(); listenerDisposable.dispose();
......
...@@ -15,14 +15,14 @@ function toFileChangesEvent(changes: IDiskFileChange[]): FileChangesEvent { ...@@ -15,14 +15,14 @@ function toFileChangesEvent(changes: IDiskFileChange[]): FileChangesEvent {
} }
class TestFileWatcher { class TestFileWatcher {
private readonly _onFileChanges: Emitter<FileChangesEvent>; private readonly _onDidFilesChange: Emitter<FileChangesEvent>;
constructor() { constructor() {
this._onFileChanges = new Emitter<FileChangesEvent>(); this._onDidFilesChange = new Emitter<FileChangesEvent>();
} }
get onFileChanges(): Event<FileChangesEvent> { get onDidFilesChange(): Event<FileChangesEvent> {
return this._onFileChanges.event; return this._onDidFilesChange.event;
} }
report(changes: IDiskFileChange[]): void { report(changes: IDiskFileChange[]): void {
...@@ -36,7 +36,7 @@ class TestFileWatcher { ...@@ -36,7 +36,7 @@ class TestFileWatcher {
// Emit through event emitter // Emit through event emitter
if (normalizedEvents.length > 0) { if (normalizedEvents.length > 0) {
this._onFileChanges.fire(toFileChangesEvent(normalizedEvents)); this._onDidFilesChange.fire(toFileChangesEvent(normalizedEvents));
} }
} }
} }
...@@ -62,7 +62,7 @@ suite('Normalizer', () => { ...@@ -62,7 +62,7 @@ suite('Normalizer', () => {
{ path: deleted.fsPath, type: FileChangeType.DELETED }, { path: deleted.fsPath, type: FileChangeType.DELETED },
]; ];
watch.onFileChanges(e => { watch.onDidFilesChange(e => {
assert.ok(e); assert.ok(e);
assert.equal(e.changes.length, 3); assert.equal(e.changes.length, 3);
assert.ok(e.contains(added, FileChangeType.ADDED)); assert.ok(e.contains(added, FileChangeType.ADDED));
...@@ -101,7 +101,7 @@ suite('Normalizer', () => { ...@@ -101,7 +101,7 @@ suite('Normalizer', () => {
{ path: updatedFile.fsPath, type: FileChangeType.UPDATED } { path: updatedFile.fsPath, type: FileChangeType.UPDATED }
]; ];
watch.onFileChanges(e => { watch.onDidFilesChange(e => {
assert.ok(e); assert.ok(e);
assert.equal(e.changes.length, 5); assert.equal(e.changes.length, 5);
...@@ -131,7 +131,7 @@ suite('Normalizer', () => { ...@@ -131,7 +131,7 @@ suite('Normalizer', () => {
{ path: unrelated.fsPath, type: FileChangeType.UPDATED }, { path: unrelated.fsPath, type: FileChangeType.UPDATED },
]; ];
watch.onFileChanges(e => { watch.onDidFilesChange(e => {
assert.ok(e); assert.ok(e);
assert.equal(e.changes.length, 1); assert.equal(e.changes.length, 1);
...@@ -156,7 +156,7 @@ suite('Normalizer', () => { ...@@ -156,7 +156,7 @@ suite('Normalizer', () => {
{ path: unrelated.fsPath, type: FileChangeType.UPDATED }, { path: unrelated.fsPath, type: FileChangeType.UPDATED },
]; ];
watch.onFileChanges(e => { watch.onDidFilesChange(e => {
assert.ok(e); assert.ok(e);
assert.equal(e.changes.length, 2); assert.equal(e.changes.length, 2);
...@@ -182,7 +182,7 @@ suite('Normalizer', () => { ...@@ -182,7 +182,7 @@ suite('Normalizer', () => {
{ path: unrelated.fsPath, type: FileChangeType.UPDATED }, { path: unrelated.fsPath, type: FileChangeType.UPDATED },
]; ];
watch.onFileChanges(e => { watch.onDidFilesChange(e => {
assert.ok(e); assert.ok(e);
assert.equal(e.changes.length, 2); assert.equal(e.changes.length, 2);
...@@ -211,7 +211,7 @@ suite('Normalizer', () => { ...@@ -211,7 +211,7 @@ suite('Normalizer', () => {
{ path: updated.fsPath, type: FileChangeType.DELETED } { path: updated.fsPath, type: FileChangeType.DELETED }
]; ];
watch.onFileChanges(e => { watch.onDidFilesChange(e => {
assert.ok(e); assert.ok(e);
assert.equal(e.changes.length, 2); assert.equal(e.changes.length, 2);
......
...@@ -224,7 +224,7 @@ export class FileStorageDatabase extends Disposable implements IStorageDatabase ...@@ -224,7 +224,7 @@ export class FileStorageDatabase extends Disposable implements IStorageDatabase
this.isWatching = true; this.isWatching = true;
this._register(this.fileService.watch(this.file)); this._register(this.fileService.watch(this.file));
this._register(this.fileService.onFileChanges(e => { this._register(this.fileService.onDidFilesChange(e => {
if (document.hasFocus()) { if (document.hasFocus()) {
return; // optimization: ignore changes from ourselves by checking for focus return; // optimization: ignore changes from ourselves by checking for focus
} }
......
...@@ -174,7 +174,7 @@ export abstract class AbstractFileSynchroniser extends AbstractSynchroniser { ...@@ -174,7 +174,7 @@ export abstract class AbstractFileSynchroniser extends AbstractSynchroniser {
) { ) {
super(source, fileService, environmentService, userDataSyncStoreService, userDataSyncEnablementService, telemetryService, logService); super(source, fileService, environmentService, userDataSyncStoreService, userDataSyncEnablementService, telemetryService, logService);
this._register(this.fileService.watch(dirname(file))); this._register(this.fileService.watch(dirname(file)));
this._register(this.fileService.onFileChanges(e => this.onFileChanges(e))); this._register(this.fileService.onDidFilesChange(e => this.onFileChanges(e)));
} }
async stop(): Promise<void> { async stop(): Promise<void> {
......
...@@ -39,7 +39,7 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs ...@@ -39,7 +39,7 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs
) { ) {
super(SyncSource.GlobalState, fileService, environmentService, userDataSyncStoreService, userDataSyncEnablementService, telemetryService, logService); super(SyncSource.GlobalState, fileService, environmentService, userDataSyncStoreService, userDataSyncEnablementService, telemetryService, logService);
this._register(this.fileService.watch(dirname(this.environmentService.argvResource))); this._register(this.fileService.watch(dirname(this.environmentService.argvResource)));
this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(this.environmentService.argvResource))(() => this._onDidChangeLocal.fire())); this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.environmentService.argvResource))(() => this._onDidChangeLocal.fire()));
} }
async pull(): Promise<void> { async pull(): Promise<void> {
......
...@@ -42,7 +42,7 @@ export class MainThreadFileSystemEventService { ...@@ -42,7 +42,7 @@ export class MainThreadFileSystemEventService {
changed: [], changed: [],
deleted: [] deleted: []
}; };
this._listener.add(fileService.onFileChanges(event => { this._listener.add(fileService.onDidFilesChange(event => {
for (let change of event.changes) { for (let change of event.changes) {
switch (change.type) { switch (change.type) {
case FileChangeType.ADDED: case FileChangeType.ADDED:
......
...@@ -24,7 +24,7 @@ suite('BulkEditPreview', function () { ...@@ -24,7 +24,7 @@ suite('BulkEditPreview', function () {
setup(function () { setup(function () {
const fileService: IFileService = new class extends mock<IFileService>() { const fileService: IFileService = new class extends mock<IFileService>() {
onFileChanges = Event.None; onDidFilesChange = Event.None;
async exists() { async exists() {
return true; return true;
} }
......
...@@ -125,7 +125,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ ...@@ -125,7 +125,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
this._register(this._editorInfoStore.onChange(() => this.updateContexts())); this._register(this._editorInfoStore.onChange(() => this.updateContexts()));
this._register(this.editorService.onDidActiveEditorChange(() => this.updateContexts())); this._register(this.editorService.onDidActiveEditorChange(() => this.updateContexts()));
this._register(fileService.onAfterOperation(e => { this._register(fileService.onDidRunOperation(e => {
if (e.isOperation(FileOperation.MOVE)) { if (e.isOperation(FileOperation.MOVE)) {
this.handleMovedFileInOpenedFileEditors(e.resource, e.target.resource); this.handleMovedFileInOpenedFileEditors(e.resource, e.target.resource);
} }
......
...@@ -124,7 +124,7 @@ export class DebugService implements IDebugService { ...@@ -124,7 +124,7 @@ export class DebugService implements IDebugService {
this.viewModel = new ViewModel(contextKeyService); this.viewModel = new ViewModel(contextKeyService);
this.taskRunner = this.instantiationService.createInstance(DebugTaskRunner); this.taskRunner = this.instantiationService.createInstance(DebugTaskRunner);
this.toDispose.push(this.fileService.onFileChanges(e => this.onFileChanges(e))); this.toDispose.push(this.fileService.onDidFilesChange(e => this.onFileChanges(e)));
this.toDispose.push(this.lifecycleService.onShutdown(this.dispose, this)); this.toDispose.push(this.lifecycleService.onShutdown(this.dispose, this));
this.toDispose.push(this.extensionHostDebugService.onAttachSession(event => { this.toDispose.push(this.extensionHostDebugService.onAttachSession(event => {
......
...@@ -53,10 +53,10 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut ...@@ -53,10 +53,10 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
private registerListeners(): void { private registerListeners(): void {
// Update editors from operation changes // Update editors from operation changes
this._register(this.fileService.onAfterOperation(e => this.onFileOperation(e))); this._register(this.fileService.onDidRunOperation(e => this.onFileOperation(e)));
// Update editors from disk changes // Update editors from disk changes
this._register(this.fileService.onFileChanges(e => this.onFileChanges(e))); this._register(this.fileService.onDidFilesChange(e => this.onDidFilesChange(e)));
// Ensure dirty text file and untitled models are always opened as editors // Ensure dirty text file and untitled models are always opened as editors
this._register(this.textFileService.files.onDidChangeDirty(m => this.ensureDirtyFilesAreOpenedWorker.work(m.resource))); this._register(this.textFileService.files.onDidChangeDirty(m => this.ensureDirtyFilesAreOpenedWorker.work(m.resource)));
...@@ -187,7 +187,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut ...@@ -187,7 +187,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut
} }
} }
private onFileChanges(e: FileChangesEvent): void { private onDidFilesChange(e: FileChangesEvent): void {
if (e.gotDeleted()) { if (e.gotDeleted()) {
this.handleDeletes(e, true); this.handleDeletes(e, true);
} }
......
...@@ -61,7 +61,7 @@ export class TextFileEditor extends BaseTextEditor { ...@@ -61,7 +61,7 @@ export class TextFileEditor extends BaseTextEditor {
this.updateRestoreViewStateConfiguration(); this.updateRestoreViewStateConfiguration();
// Clear view state for deleted files // Clear view state for deleted files
this._register(this.fileService.onFileChanges(e => this.onFilesChanged(e))); this._register(this.fileService.onDidFilesChange(e => this.onFilesChanged(e)));
} }
private onFilesChanged(e: FileChangesEvent): void { private onFilesChanged(e: FileChangesEvent): void {
......
...@@ -56,8 +56,8 @@ export class ExplorerService implements IExplorerService { ...@@ -56,8 +56,8 @@ export class ExplorerService implements IExplorerService {
this.model = new ExplorerModel(this.contextService, this.fileService); this.model = new ExplorerModel(this.contextService, this.fileService);
this.disposables.add(this.model); this.disposables.add(this.model);
this.disposables.add(this.fileService.onAfterOperation(e => this.onFileOperation(e))); this.disposables.add(this.fileService.onDidRunOperation(e => this.onDidRunOperation(e)));
this.disposables.add(this.fileService.onFileChanges(e => this.onFileChanges(e))); this.disposables.add(this.fileService.onDidFilesChange(e => this.onDidFilesChange(e)));
this.disposables.add(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(this.configurationService.getValue<IFilesConfiguration>()))); this.disposables.add(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(this.configurationService.getValue<IFilesConfiguration>())));
this.disposables.add(Event.any<{ scheme: string }>(this.fileService.onDidChangeFileSystemProviderRegistrations, this.fileService.onDidChangeFileSystemProviderCapabilities)(e => { this.disposables.add(Event.any<{ scheme: string }>(this.fileService.onDidChangeFileSystemProviderRegistrations, this.fileService.onDidChangeFileSystemProviderCapabilities)(e => {
let affected = false; let affected = false;
...@@ -214,7 +214,7 @@ export class ExplorerService implements IExplorerService { ...@@ -214,7 +214,7 @@ export class ExplorerService implements IExplorerService {
// File events // File events
private onFileOperation(e: FileOperationEvent): void { private onDidRunOperation(e: FileOperationEvent): void {
// Add // Add
if (e.isOperation(FileOperation.CREATE) || e.isOperation(FileOperation.COPY)) { if (e.isOperation(FileOperation.CREATE) || e.isOperation(FileOperation.COPY)) {
const addedElement = e.target; const addedElement = e.target;
...@@ -294,7 +294,7 @@ export class ExplorerService implements IExplorerService { ...@@ -294,7 +294,7 @@ export class ExplorerService implements IExplorerService {
} }
} }
private onFileChanges(e: FileChangesEvent): void { private onDidFilesChange(e: FileChangesEvent): void {
// Check if an explorer refresh is necessary (delayed to give internal events a chance to react first) // Check if an explorer refresh is necessary (delayed to give internal events a chance to react first)
// Note: there is no guarantee when the internal events are fired vs real ones. Code has to deal with the fact that one might // Note: there is no guarantee when the internal events are fired vs real ones. Code has to deal with the fact that one might
// be fired first over the other or not at all. // be fired first over the other or not at all.
......
...@@ -171,7 +171,7 @@ export class TextFileContentProvider extends Disposable implements ITextModelCon ...@@ -171,7 +171,7 @@ export class TextFileContentProvider extends Disposable implements ITextModelCon
// Make sure to keep contents up to date when it changes // Make sure to keep contents up to date when it changes
if (!this.fileWatcherDisposable.value) { if (!this.fileWatcherDisposable.value) {
this.fileWatcherDisposable.value = this.fileService.onFileChanges(changes => { this.fileWatcherDisposable.value = this.fileService.onDidFilesChange(changes => {
if (changes.contains(savedFileResource, FileChangeType.UPDATED)) { if (changes.contains(savedFileResource, FileChangeType.UPDATED)) {
this.resolveEditorModel(resource, false /* do not create if missing */); // update model when resource changes this.resolveEditorModel(resource, false /* do not create if missing */); // update model when resource changes
} }
......
...@@ -80,7 +80,7 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution { ...@@ -80,7 +80,7 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution {
} }
const watcher = this.fileService.watch(dirname(file)); const watcher = this.fileService.watch(dirname(file));
const disposable = this.fileService.onFileChanges(e => { const disposable = this.fileService.onDidFilesChange(e => {
if (e.contains(file, FileChangeType.ADDED) || e.contains(file, FileChangeType.UPDATED)) { if (e.contains(file, FileChangeType.ADDED) || e.contains(file, FileChangeType.UPDATED)) {
watcher.dispose(); watcher.dispose();
disposable.dispose(); disposable.dispose();
......
...@@ -212,7 +212,7 @@ export class SearchView extends ViewPane { ...@@ -212,7 +212,7 @@ export class SearchView extends ViewPane {
this.memento = new Memento(this.id, storageService); this.memento = new Memento(this.id, storageService);
this.viewletState = this.memento.getMemento(StorageScope.WORKSPACE); this.viewletState = this.memento.getMemento(StorageScope.WORKSPACE);
this._register(this.fileService.onFileChanges(e => this.onFilesChanged(e))); this._register(this.fileService.onDidFilesChange(e => this.onFilesChanged(e)));
this._register(this.textFileService.untitled.onDidDisposeModel(e => this.onUntitledDidDispose(e))); this._register(this.textFileService.untitled.onDidDisposeModel(e => this.onUntitledDidDispose(e)));
this._register(this.contextService.onDidChangeWorkbenchState(() => this.onDidChangeWorkbenchState())); this._register(this.contextService.onDidChangeWorkbenchState(() => this.onDidChangeWorkbenchState()));
this._register(this.searchHistoryService.onDidClearHistory(() => this.clearHistory())); this._register(this.searchHistoryService.onDidClearHistory(() => this.clearHistory()));
......
...@@ -116,7 +116,7 @@ namespace snippetExt { ...@@ -116,7 +116,7 @@ namespace snippetExt {
function watch(service: IFileService, resource: URI, callback: (type: FileChangeType, resource: URI) => any): IDisposable { function watch(service: IFileService, resource: URI, callback: (type: FileChangeType, resource: URI) => any): IDisposable {
return combinedDisposable( return combinedDisposable(
service.watch(resource), service.watch(resource),
service.onFileChanges(e => { service.onDidFilesChange(e => {
for (const change of e.changes) { for (const change of e.changes) {
if (resources.isEqualOrParent(change.resource, resource)) { if (resources.isEqualOrParent(change.resource, resource)) {
callback(change.type, change.resource); callback(change.type, change.resource);
...@@ -277,7 +277,7 @@ class SnippetsService implements ISnippetsService { ...@@ -277,7 +277,7 @@ class SnippetsService implements ISnippetsService {
this._initFolderSnippets(SnippetSource.Workspace, snippetFolder, bucket); this._initFolderSnippets(SnippetSource.Workspace, snippetFolder, bucket);
} else { } else {
// watch // watch
bucket.add(this._fileService.onFileChanges(e => { bucket.add(this._fileService.onDidFilesChange(e => {
if (e.contains(snippetFolder, FileChangeType.ADDED)) { if (e.contains(snippetFolder, FileChangeType.ADDED)) {
this._initFolderSnippets(SnippetSource.Workspace, snippetFolder, bucket); this._initFolderSnippets(SnippetSource.Workspace, snippetFolder, bucket);
} }
......
...@@ -50,7 +50,7 @@ export class ConflictDetector { ...@@ -50,7 +50,7 @@ export class ConflictDetector {
} }
// listen to file changes // listen to file changes
this._disposables.add(fileService.onFileChanges(e => { this._disposables.add(fileService.onDidFilesChange(e => {
for (let change of e.changes) { for (let change of e.changes) {
if (modelService.getModel(change.resource)) { if (modelService.getModel(change.resource)) {
......
...@@ -86,7 +86,7 @@ class FileServiceBasedConfigurationWithNames extends Disposable { ...@@ -86,7 +86,7 @@ class FileServiceBasedConfigurationWithNames extends Disposable {
this._cache = new ConfigurationModel(); this._cache = new ConfigurationModel();
this.changeEventTriggerScheduler = this._register(new RunOnceScheduler(() => this._onDidChange.fire(), 50)); this.changeEventTriggerScheduler = this._register(new RunOnceScheduler(() => this._onDidChange.fire(), 50));
this._register(this.fileService.onFileChanges((e) => this.handleFileEvents(e))); this._register(this.fileService.onDidFilesChange((e) => this.handleFileEvents(e)));
} }
async loadConfiguration(): Promise<ConfigurationModel> { async loadConfiguration(): Promise<ConfigurationModel> {
...@@ -268,7 +268,7 @@ class FileServiceBasedRemoteUserConfiguration extends Disposable { ...@@ -268,7 +268,7 @@ class FileServiceBasedRemoteUserConfiguration extends Disposable {
super(); super();
this.parser = new ConfigurationModelParser(this.configurationResource.toString(), this.scopes); this.parser = new ConfigurationModelParser(this.configurationResource.toString(), this.scopes);
this._register(fileService.onFileChanges(e => this.handleFileEvents(e))); this._register(fileService.onDidFilesChange(e => this.handleFileEvents(e)));
this.reloadConfigurationScheduler = this._register(new RunOnceScheduler(() => this.reload().then(configurationModel => this._onDidChangeConfiguration.fire(configurationModel)), 50)); this.reloadConfigurationScheduler = this._register(new RunOnceScheduler(() => this.reload().then(configurationModel => this._onDidChangeConfiguration.fire(configurationModel)), 50));
this._register(toDisposable(() => { this._register(toDisposable(() => {
this.stopWatchingResource(); this.stopWatchingResource();
...@@ -523,7 +523,7 @@ class FileServiceBasedWorkspaceConfiguration extends Disposable implements IWork ...@@ -523,7 +523,7 @@ class FileServiceBasedWorkspaceConfiguration extends Disposable implements IWork
this.workspaceConfigurationModelParser = new WorkspaceConfigurationModelParser(''); this.workspaceConfigurationModelParser = new WorkspaceConfigurationModelParser('');
this.workspaceSettings = new ConfigurationModel(); this.workspaceSettings = new ConfigurationModel();
this._register(fileService.onFileChanges(e => this.handleWorkspaceFileEvents(e))); this._register(fileService.onDidFilesChange(e => this.handleWorkspaceFileEvents(e)));
this.reloadConfigurationScheduler = this._register(new RunOnceScheduler(() => this._onDidChange.fire(), 50)); this.reloadConfigurationScheduler = this._register(new RunOnceScheduler(() => this._onDidChange.fire(), 50));
this.workspaceConfigWatcher = this._register(this.watchWorkspaceConfigurationFile()); this.workspaceConfigWatcher = this._register(this.watchWorkspaceConfigurationFile());
} }
......
...@@ -125,7 +125,7 @@ export class HistoryService extends Disposable implements IHistoryService { ...@@ -125,7 +125,7 @@ export class HistoryService extends Disposable implements IHistoryService {
this._register(this.editorService.onDidOpenEditorFail(event => this.remove(event.editor))); this._register(this.editorService.onDidOpenEditorFail(event => this.remove(event.editor)));
this._register(this.editorService.onDidCloseEditor(event => this.onEditorClosed(event))); this._register(this.editorService.onDidCloseEditor(event => this.onEditorClosed(event)));
this._register(this.storageService.onWillSaveState(() => this.saveState())); this._register(this.storageService.onWillSaveState(() => this.saveState()));
this._register(this.fileService.onFileChanges(event => this.onFileChanges(event))); this._register(this.fileService.onDidFilesChange(event => this.onDidFilesChange(event)));
this._register(this.resourceFilter.onExpressionChange(() => this.removeExcludedFromHistory())); this._register(this.resourceFilter.onExpressionChange(() => this.removeExcludedFromHistory()));
this._register(this.editorService.onDidMostRecentlyActiveEditorsChange(() => this.handleEditorEventInRecentEditorsStack())); this._register(this.editorService.onDidMostRecentlyActiveEditorsChange(() => this.handleEditorEventInRecentEditorsStack()));
...@@ -220,7 +220,7 @@ export class HistoryService extends Disposable implements IHistoryService { ...@@ -220,7 +220,7 @@ export class HistoryService extends Disposable implements IHistoryService {
return identifier.editor.matches(editor.input); return identifier.editor.matches(editor.input);
} }
private onFileChanges(e: FileChangesEvent): void { private onDidFilesChange(e: FileChangesEvent): void {
if (e.gotDeleted()) { if (e.gotDeleted()) {
this.remove(e); // remove from history files that got deleted or moved this.remove(e); // remove from history files that got deleted or moved
} }
......
...@@ -635,7 +635,7 @@ class UserKeybindings extends Disposable { ...@@ -635,7 +635,7 @@ class UserKeybindings extends Disposable {
this._onDidChange.fire(); this._onDidChange.fire();
} }
}), 50)); }), 50));
this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(this.keybindingsResource))(() => this.reloadConfigurationScheduler.schedule())); this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.keybindingsResource))(() => this.reloadConfigurationScheduler.schedule()));
} }
async initialize(): Promise<void> { async initialize(): Promise<void> {
......
...@@ -474,7 +474,7 @@ class UserKeyboardLayout extends Disposable { ...@@ -474,7 +474,7 @@ class UserKeyboardLayout extends Disposable {
} }
}), 50)); }), 50));
this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(this.keyboardLayoutResource))(() => this.reloadConfigurationScheduler.schedule())); this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.keyboardLayoutResource))(() => this.reloadConfigurationScheduler.schedule()));
} }
async initialize(): Promise<void> { async initialize(): Promise<void> {
......
...@@ -52,7 +52,7 @@ class OutputChannelBackedByFile extends AbstractFileOutputChannelModel implement ...@@ -52,7 +52,7 @@ class OutputChannelBackedByFile extends AbstractFileOutputChannelModel implement
this.rotatingFilePath = resources.joinPath(rotatingFilePathDirectory, `${id}.1.log`); this.rotatingFilePath = resources.joinPath(rotatingFilePathDirectory, `${id}.1.log`);
this._register(fileService.watch(rotatingFilePathDirectory)); this._register(fileService.watch(rotatingFilePathDirectory));
this._register(fileService.onFileChanges(e => { this._register(fileService.onDidFilesChange(e => {
if (e.contains(this.rotatingFilePath)) { if (e.contains(this.rotatingFilePath)) {
this.resettingDelayer.trigger(() => this.resetModel()); this.resettingDelayer.trigger(() => this.resetModel());
} }
......
...@@ -110,11 +110,11 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil ...@@ -110,11 +110,11 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
} }
private registerListeners(): void { private registerListeners(): void {
this._register(this.fileService.onFileChanges(e => this.onFileChanges(e))); this._register(this.fileService.onDidFilesChange(e => this.onDidFilesChange(e)));
this._register(this.filesConfigurationService.onFilesAssociationChange(e => this.onFilesAssociationChange())); this._register(this.filesConfigurationService.onFilesAssociationChange(e => this.onFilesAssociationChange()));
} }
private async onFileChanges(e: FileChangesEvent): Promise<void> { private async onDidFilesChange(e: FileChangesEvent): Promise<void> {
let fileEventImpactsModel = false; let fileEventImpactsModel = false;
let newInOrphanModeGuess: boolean | undefined; let newInOrphanModeGuess: boolean | undefined;
......
...@@ -83,7 +83,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE ...@@ -83,7 +83,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
private registerListeners(): void { private registerListeners(): void {
// Update models from file change events // Update models from file change events
this._register(this.fileService.onFileChanges(e => this.onFileChanges(e))); this._register(this.fileService.onDidFilesChange(e => this.onDidFilesChange(e)));
// Working copy operations // Working copy operations
this._register(this.workingCopyFileService.onWillRunWorkingCopyFileOperation(e => this.onWillRunWorkingCopyFileOperation(e))); this._register(this.workingCopyFileService.onWillRunWorkingCopyFileOperation(e => this.onWillRunWorkingCopyFileOperation(e)));
...@@ -94,7 +94,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE ...@@ -94,7 +94,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
this.lifecycleService.onShutdown(this.dispose, this); this.lifecycleService.onShutdown(this.dispose, this);
} }
private onFileChanges(e: FileChangesEvent): void { private onDidFilesChange(e: FileChangesEvent): void {
// Collect distinct (saved) models to update. // Collect distinct (saved) models to update.
// //
......
...@@ -252,7 +252,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { ...@@ -252,7 +252,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
} }
}); });
this.fileService.onFileChanges(async e => { this.fileService.onDidFilesChange(async e => {
if (this.watchedColorThemeLocation && this.currentColorTheme && e.contains(this.watchedColorThemeLocation, FileChangeType.UPDATED)) { if (this.watchedColorThemeLocation && this.currentColorTheme && e.contains(this.watchedColorThemeLocation, FileChangeType.UPDATED)) {
this.reloadCurrentColorTheme(); this.reloadCurrentColorTheme();
} }
......
...@@ -348,7 +348,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -348,7 +348,7 @@ suite('FileUserDataProvider - Watching', () => {
test('file added change event', done => { test('file added change event', done => {
const expected = joinPath(userDataResource, 'settings.json'); const expected = joinPath(userDataResource, 'settings.json');
const target = joinPath(localUserDataResource, 'settings.json'); const target = joinPath(localUserDataResource, 'settings.json');
testObject.onFileChanges(e => { testObject.onDidFilesChange(e => {
if (e.contains(expected, FileChangeType.ADDED)) { if (e.contains(expected, FileChangeType.ADDED)) {
done(); done();
} }
...@@ -362,7 +362,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -362,7 +362,7 @@ suite('FileUserDataProvider - Watching', () => {
test('file updated change event', done => { test('file updated change event', done => {
const expected = joinPath(userDataResource, 'settings.json'); const expected = joinPath(userDataResource, 'settings.json');
const target = joinPath(localUserDataResource, 'settings.json'); const target = joinPath(localUserDataResource, 'settings.json');
testObject.onFileChanges(e => { testObject.onDidFilesChange(e => {
if (e.contains(expected, FileChangeType.UPDATED)) { if (e.contains(expected, FileChangeType.UPDATED)) {
done(); done();
} }
...@@ -376,7 +376,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -376,7 +376,7 @@ suite('FileUserDataProvider - Watching', () => {
test('file deleted change event', done => { test('file deleted change event', done => {
const expected = joinPath(userDataResource, 'settings.json'); const expected = joinPath(userDataResource, 'settings.json');
const target = joinPath(localUserDataResource, 'settings.json'); const target = joinPath(localUserDataResource, 'settings.json');
testObject.onFileChanges(e => { testObject.onDidFilesChange(e => {
if (e.contains(expected, FileChangeType.DELETED)) { if (e.contains(expected, FileChangeType.DELETED)) {
done(); done();
} }
...@@ -390,7 +390,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -390,7 +390,7 @@ suite('FileUserDataProvider - Watching', () => {
test('file under folder created change event', done => { test('file under folder created change event', done => {
const expected = joinPath(userDataResource, 'snippets', 'settings.json'); const expected = joinPath(userDataResource, 'snippets', 'settings.json');
const target = joinPath(localUserDataResource, 'snippets', 'settings.json'); const target = joinPath(localUserDataResource, 'snippets', 'settings.json');
testObject.onFileChanges(e => { testObject.onDidFilesChange(e => {
if (e.contains(expected, FileChangeType.ADDED)) { if (e.contains(expected, FileChangeType.ADDED)) {
done(); done();
} }
...@@ -404,7 +404,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -404,7 +404,7 @@ suite('FileUserDataProvider - Watching', () => {
test('file under folder updated change event', done => { test('file under folder updated change event', done => {
const expected = joinPath(userDataResource, 'snippets', 'settings.json'); const expected = joinPath(userDataResource, 'snippets', 'settings.json');
const target = joinPath(localUserDataResource, 'snippets', 'settings.json'); const target = joinPath(localUserDataResource, 'snippets', 'settings.json');
testObject.onFileChanges(e => { testObject.onDidFilesChange(e => {
if (e.contains(expected, FileChangeType.UPDATED)) { if (e.contains(expected, FileChangeType.UPDATED)) {
done(); done();
} }
...@@ -418,7 +418,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -418,7 +418,7 @@ suite('FileUserDataProvider - Watching', () => {
test('file under folder deleted change event', done => { test('file under folder deleted change event', done => {
const expected = joinPath(userDataResource, 'snippets', 'settings.json'); const expected = joinPath(userDataResource, 'snippets', 'settings.json');
const target = joinPath(localUserDataResource, 'snippets', 'settings.json'); const target = joinPath(localUserDataResource, 'snippets', 'settings.json');
testObject.onFileChanges(e => { testObject.onDidFilesChange(e => {
if (e.contains(expected, FileChangeType.DELETED)) { if (e.contains(expected, FileChangeType.DELETED)) {
done(); done();
} }
...@@ -432,7 +432,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -432,7 +432,7 @@ suite('FileUserDataProvider - Watching', () => {
test('event is not triggered if file is not under user data', async () => { test('event is not triggered if file is not under user data', async () => {
const target = joinPath(dirname(localUserDataResource), 'settings.json'); const target = joinPath(dirname(localUserDataResource), 'settings.json');
let triggered = false; let triggered = false;
testObject.onFileChanges(() => triggered = true); testObject.onDidFilesChange(() => triggered = true);
fileEventEmitter.fire([{ fileEventEmitter.fire([{
resource: target, resource: target,
type: FileChangeType.DELETED type: FileChangeType.DELETED
...@@ -446,7 +446,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -446,7 +446,7 @@ suite('FileUserDataProvider - Watching', () => {
test('backup file created change event', done => { test('backup file created change event', done => {
const expected = joinPath(userDataResource, BACKUPS, 'settings.json'); const expected = joinPath(userDataResource, BACKUPS, 'settings.json');
const target = joinPath(localBackupsResource, 'settings.json'); const target = joinPath(localBackupsResource, 'settings.json');
testObject.onFileChanges(e => { testObject.onDidFilesChange(e => {
if (e.contains(expected, FileChangeType.ADDED)) { if (e.contains(expected, FileChangeType.ADDED)) {
done(); done();
} }
...@@ -460,7 +460,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -460,7 +460,7 @@ suite('FileUserDataProvider - Watching', () => {
test('backup file update change event', done => { test('backup file update change event', done => {
const expected = joinPath(userDataResource, BACKUPS, 'settings.json'); const expected = joinPath(userDataResource, BACKUPS, 'settings.json');
const target = joinPath(localBackupsResource, 'settings.json'); const target = joinPath(localBackupsResource, 'settings.json');
testObject.onFileChanges(e => { testObject.onDidFilesChange(e => {
if (e.contains(expected, FileChangeType.UPDATED)) { if (e.contains(expected, FileChangeType.UPDATED)) {
done(); done();
} }
...@@ -474,7 +474,7 @@ suite('FileUserDataProvider - Watching', () => { ...@@ -474,7 +474,7 @@ suite('FileUserDataProvider - Watching', () => {
test('backup file delete change event', done => { test('backup file delete change event', done => {
const expected = joinPath(userDataResource, BACKUPS, 'settings.json'); const expected = joinPath(userDataResource, BACKUPS, 'settings.json');
const target = joinPath(localBackupsResource, 'settings.json'); const target = joinPath(localBackupsResource, 'settings.json');
testObject.onFileChanges(e => { testObject.onDidFilesChange(e => {
if (e.contains(expected, FileChangeType.DELETED)) { if (e.contains(expected, FileChangeType.DELETED)) {
done(); done();
} }
......
...@@ -58,7 +58,7 @@ suite('MainThreadDocumentsAndEditors', () => { ...@@ -58,7 +58,7 @@ suite('MainThreadDocumentsAndEditors', () => {
const editorGroupService = new TestEditorGroupsService(); const editorGroupService = new TestEditorGroupsService();
const fileService = new class extends mock<IFileService>() { const fileService = new class extends mock<IFileService>() {
onAfterOperation = Event.None; onDidRunOperation = Event.None;
}; };
new MainThreadDocumentsAndEditors( new MainThreadDocumentsAndEditors(
......
...@@ -603,8 +603,8 @@ export class TestFileService implements IFileService { ...@@ -603,8 +603,8 @@ export class TestFileService implements IFileService {
_serviceBrand: undefined; _serviceBrand: undefined;
private readonly _onFileChanges: Emitter<FileChangesEvent>; private readonly _onDidFilesChange = new Emitter<FileChangesEvent>();
private readonly _onAfterOperation: Emitter<FileOperationEvent>; private readonly _onDidRunOperation = new Emitter<FileOperationEvent>();
readonly onWillActivateFileSystemProvider = Event.None; readonly onWillActivateFileSystemProvider = Event.None;
readonly onDidChangeFileSystemProviderCapabilities = Event.None; readonly onDidChangeFileSystemProviderCapabilities = Event.None;
...@@ -613,18 +613,13 @@ export class TestFileService implements IFileService { ...@@ -613,18 +613,13 @@ export class TestFileService implements IFileService {
private content = 'Hello Html'; private content = 'Hello Html';
private lastReadFileUri!: URI; private lastReadFileUri!: URI;
constructor() {
this._onFileChanges = new Emitter<FileChangesEvent>();
this._onAfterOperation = new Emitter<FileOperationEvent>();
}
setContent(content: string): void { this.content = content; } setContent(content: string): void { this.content = content; }
getContent(): string { return this.content; } getContent(): string { return this.content; }
getLastReadFileUri(): URI { return this.lastReadFileUri; } getLastReadFileUri(): URI { return this.lastReadFileUri; }
get onFileChanges(): Event<FileChangesEvent> { return this._onFileChanges.event; } get onDidFilesChange(): Event<FileChangesEvent> { return this._onDidFilesChange.event; }
fireFileChanges(event: FileChangesEvent): void { this._onFileChanges.fire(event); } fireFileChanges(event: FileChangesEvent): void { this._onDidFilesChange.fire(event); }
get onAfterOperation(): Event<FileOperationEvent> { return this._onAfterOperation.event; } get onDidRunOperation(): Event<FileOperationEvent> { return this._onDidRunOperation.event; }
fireAfterOperation(event: FileOperationEvent): void { this._onAfterOperation.fire(event); } fireAfterOperation(event: FileOperationEvent): void { this._onDidRunOperation.fire(event); }
resolve(resource: URI, _options?: IResolveFileOptions): Promise<IFileStat>; resolve(resource: URI, _options?: IResolveFileOptions): Promise<IFileStat>;
resolve(resource: URI, _options: IResolveMetadataFileOptions): Promise<IFileStatWithMetadata>; resolve(resource: URI, _options: IResolveMetadataFileOptions): Promise<IFileStatWithMetadata>;
resolve(resource: URI, _options?: IResolveFileOptions): Promise<IFileStat> { resolve(resource: URI, _options?: IResolveFileOptions): Promise<IFileStat> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册