@@ -53,8 +53,8 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
5353 this . _provider . get ( handle ) . $onFileSystemChange ( changes ) ;
5454 }
5555
56- $reportFileChunk ( handle : number , data : UriComponents , chunk : number [ ] ) : void {
57- this . _provider . get ( handle ) . reportFileChunk ( URI . revive ( data ) , chunk ) ;
56+ $reportFileChunk ( handle : number , session : number , chunk : number [ ] ) : void {
57+ this . _provider . get ( handle ) . reportFileChunk ( session , chunk ) ;
5858 }
5959
6060 // --- search
@@ -64,10 +64,22 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
6464 }
6565}
6666
67+ class FileReadOperation {
68+
69+ private static _idPool = 0 ;
70+
71+ constructor (
72+ readonly progress : IProgress < Uint8Array > ,
73+ readonly id : number = ++ FileReadOperation . _idPool
74+ ) {
75+ //
76+ }
77+ }
78+
6779class RemoteFileSystemProvider implements IFileSystemProvider , ISearchResultProvider {
6880
6981 private readonly _onDidChange = new Emitter < IFileChange [ ] > ( ) ;
70- private readonly _reads = new Map < string , IProgress < Uint8Array > > ( ) ;
82+ private readonly _reads = new Map < number , FileReadOperation > ( ) ;
7183 private readonly _registrations : IDisposable [ ] ;
7284
7385 readonly onDidChange : Event < IFileChange [ ] > = this . _onDidChange . event ;
@@ -104,11 +116,12 @@ class RemoteFileSystemProvider implements IFileSystemProvider, ISearchResultProv
104116 return this . _proxy . $stat ( this . _handle , resource ) ;
105117 }
106118 read ( resource : URI , offset : number , count : number , progress : IProgress < Uint8Array > ) : TPromise < number , any > {
107- this . _reads . set ( resource . toString ( ) , progress ) ;
108- return this . _proxy . $read ( this . _handle , offset , count , resource ) ;
119+ const read = new FileReadOperation ( progress ) ;
120+ this . _reads . set ( read . id , read ) ;
121+ return this . _proxy . $read ( this . _handle , read . id , offset , count , resource ) ;
109122 }
110- reportFileChunk ( resource : URI , chunk : number [ ] ) : void {
111- this . _reads . get ( resource . toString ( ) ) . report ( Buffer . from ( chunk ) ) ;
123+ reportFileChunk ( session : number , chunk : number [ ] ) : void {
124+ this . _reads . get ( session ) . progress . report ( Buffer . from ( chunk ) ) ;
112125 }
113126 write ( resource : URI , content : Uint8Array ) : TPromise < void , any > {
114127 return this . _proxy . $write ( this . _handle , resource , [ ] . slice . call ( content ) ) ;
@@ -143,7 +156,7 @@ class RemoteFileSystemProvider implements IFileSystemProvider, ISearchResultProv
143156 const id = ++ this . _searchesIdPool ;
144157 const matches : IFileMatch [ ] = [ ] ;
145158 return new PPromise ( ( resolve , reject , report ) => {
146- this . _proxy . $fileFiles ( this . _handle , id , query . filePattern ) . then ( ( ) => {
159+ this . _proxy . $findFiles ( this . _handle , id , query . filePattern ) . then ( ( ) => {
147160 this . _searches . delete ( id ) ;
148161 resolve ( {
149162 results : matches ,
0 commit comments