mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 04:23:32 +01:00
Making IFileChange readonly
This commit is contained in:
@@ -123,10 +123,10 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
|
||||
|
||||
class RemoteFileSystemProvider implements IFileSystemProvider {
|
||||
|
||||
private readonly _onDidChange = new Emitter<IFileChange[]>();
|
||||
private readonly _onDidChange = new Emitter<readonly IFileChange[]>();
|
||||
private readonly _registration: IDisposable;
|
||||
|
||||
readonly onDidChangeFile: Event<IFileChange[]> = this._onDidChange.event;
|
||||
readonly onDidChangeFile: Event<readonly IFileChange[]> = this._onDidChange.event;
|
||||
|
||||
readonly capabilities: FileSystemProviderCapabilities;
|
||||
readonly onDidChangeCapabilities: Event<void> = Event.None;
|
||||
|
||||
@@ -17,8 +17,8 @@ export abstract class KeyValueLogProvider extends Disposable implements IFileSys
|
||||
readonly capabilities: FileSystemProviderCapabilities = FileSystemProviderCapabilities.FileReadWrite;
|
||||
readonly onDidChangeCapabilities: Event<void> = Event.None;
|
||||
|
||||
private readonly _onDidChangeFile: Emitter<IFileChange[]> = this._register(new Emitter<IFileChange[]>());
|
||||
readonly onDidChangeFile: Event<IFileChange[]> = this._onDidChangeFile.event;
|
||||
private readonly _onDidChangeFile = this._register(new Emitter<readonly IFileChange[]>());
|
||||
readonly onDidChangeFile: Event<readonly IFileChange[]> = this._onDidChangeFile.event;
|
||||
|
||||
private readonly versions: Map<string, number> = new Map<string, number>();
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ export class FileUserDataProvider extends Disposable implements IFileSystemProvi
|
||||
readonly capabilities: FileSystemProviderCapabilities = this.fileSystemProvider.capabilities;
|
||||
readonly onDidChangeCapabilities: Event<void> = Event.None;
|
||||
|
||||
private readonly _onDidChangeFile: Emitter<IFileChange[]> = this._register(new Emitter<IFileChange[]>());
|
||||
readonly onDidChangeFile: Event<IFileChange[]> = this._onDidChangeFile.event;
|
||||
private readonly _onDidChangeFile = this._register(new Emitter<readonly IFileChange[]>());
|
||||
readonly onDidChangeFile: Event<readonly IFileChange[]> = this._onDidChangeFile.event;
|
||||
|
||||
private readonly userDataHome: URI;
|
||||
|
||||
@@ -103,7 +103,7 @@ export class FileUserDataProvider extends Disposable implements IFileSystemProvi
|
||||
return this.fileSystemProvider.delete(this.toFileSystemResource(resource), opts);
|
||||
}
|
||||
|
||||
private handleFileChanges(changes: IFileChange[]): void {
|
||||
private handleFileChanges(changes: readonly IFileChange[]): void {
|
||||
const userDataChanges: IFileChange[] = [];
|
||||
for (const change of changes) {
|
||||
const userDataResource = this.toUserDataResource(change.resource);
|
||||
@@ -139,4 +139,4 @@ export class FileUserDataProvider extends Disposable implements IFileSystemProvi
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,8 +205,8 @@ export class InMemoryFileSystemProvider extends Disposable implements IFileSyste
|
||||
|
||||
// --- manage file events
|
||||
|
||||
private readonly _onDidChangeFile: Emitter<IFileChange[]> = this._register(new Emitter<IFileChange[]>());
|
||||
readonly onDidChangeFile: Event<IFileChange[]> = this._onDidChangeFile.event;
|
||||
private readonly _onDidChangeFile = this._register(new Emitter<readonly IFileChange[]>());
|
||||
readonly onDidChangeFile: Event<readonly IFileChange[]> = this._onDidChangeFile.event;
|
||||
|
||||
private _bufferedChanges: IFileChange[] = [];
|
||||
private _fireSoonHandle?: any;
|
||||
|
||||
@@ -277,7 +277,7 @@ suite('FileUserDataProvider', () => {
|
||||
|
||||
class TestFileSystemProvider implements IFileSystemProviderWithFileReadWriteCapability {
|
||||
|
||||
constructor(readonly onDidChangeFile: Event<IFileChange[]>) { }
|
||||
constructor(readonly onDidChangeFile: Event<readonly IFileChange[]>) { }
|
||||
|
||||
readonly capabilities: FileSystemProviderCapabilities = FileSystemProviderCapabilities.FileReadWrite;
|
||||
|
||||
@@ -309,7 +309,7 @@ suite('FileUserDataProvider - Watching', () => {
|
||||
let userDataResource: URI;
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
const fileEventEmitter: Emitter<IFileChange[]> = new Emitter<IFileChange[]>();
|
||||
const fileEventEmitter: Emitter<readonly IFileChange[]> = new Emitter<readonly IFileChange[]>();
|
||||
disposables.add(fileEventEmitter);
|
||||
|
||||
setup(() => {
|
||||
|
||||
@@ -1346,7 +1346,12 @@ export class RemoteFileSystemProvider implements IFileSystemProvider {
|
||||
readonly capabilities: FileSystemProviderCapabilities = this.diskFileSystemProvider.capabilities;
|
||||
readonly onDidChangeCapabilities: Event<void> = this.diskFileSystemProvider.onDidChangeCapabilities;
|
||||
|
||||
readonly onDidChangeFile: Event<IFileChange[]> = Event.map(this.diskFileSystemProvider.onDidChangeFile, changes => changes.map(c => { c.resource = c.resource.with({ scheme: Schemas.vscodeRemote, authority: this.remoteAuthority }); return c; }));
|
||||
readonly onDidChangeFile: Event<readonly IFileChange[]> = Event.map(this.diskFileSystemProvider.onDidChangeFile, changes => changes.map((c): IFileChange => {
|
||||
return {
|
||||
type: c.type,
|
||||
resource: c.resource.with({ scheme: Schemas.vscodeRemote, authority: this.remoteAuthority }),
|
||||
};
|
||||
}));
|
||||
watch(resource: URI, opts: IWatchOptions): IDisposable { return this.diskFileSystemProvider.watch(this.toFileResource(resource), opts); }
|
||||
|
||||
stat(resource: URI): Promise<IStat> { return this.diskFileSystemProvider.stat(this.toFileResource(resource)); }
|
||||
|
||||
Reference in New Issue
Block a user