mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
first cut of explict watch, #47475
This commit is contained in:
@@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { FileOpenFlags, IFileChange, IFileService, IFileSystemProviderBase, ISimpleReadWriteProvider, IStat } from 'vs/platform/files/common/files';
|
||||
import { FileOpenFlags, IFileChange, IFileService, IFileSystemProviderBase, ISimpleReadWriteProvider, IStat, IWatchOptions } from 'vs/platform/files/common/files';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { ExtHostContext, ExtHostFileSystemShape, IExtHostContext, IFileChangeDto, MainContext, MainThreadFileSystemShape } from '../node/extHost.protocol';
|
||||
|
||||
@@ -50,7 +50,7 @@ class RemoteFileSystemProvider implements ISimpleReadWriteProvider, IFileSystemP
|
||||
private readonly _onDidChange = new Emitter<IFileChange[]>();
|
||||
private readonly _registrations: IDisposable[];
|
||||
|
||||
readonly onDidChange: Event<IFileChange[]> = this._onDidChange.event;
|
||||
readonly onDidChangeFile: Event<IFileChange[]> = this._onDidChange.event;
|
||||
|
||||
constructor(
|
||||
fileService: IFileService,
|
||||
@@ -66,6 +66,16 @@ class RemoteFileSystemProvider implements ISimpleReadWriteProvider, IFileSystemP
|
||||
this._onDidChange.dispose();
|
||||
}
|
||||
|
||||
watch(resource: URI, opts: IWatchOptions) {
|
||||
const session = Math.random();
|
||||
this._proxy.$watch(this._handle, session, resource, opts);
|
||||
return {
|
||||
dispose: () => {
|
||||
this._proxy.$unwatch(this._handle, session);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$onFileSystemChange(changes: IFileChangeDto[]): void {
|
||||
this._onDidChange.fire(changes.map(RemoteFileSystemProvider._createFileChange));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user