@@ -88,7 +88,9 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
88
88
const name = item . Name ;
89
89
const fullName = folder === "" ? name : csp ? folder + name : folder + "/" + name ;
90
90
if ( item . Type === "10" || item . Type === "9" ) {
91
- parent . entries . set ( name , new Directory ( name , fullName ) ) ;
91
+ if ( ! parent . entries . has ( name ) ) {
92
+ parent . entries . set ( name , new Directory ( name , fullName ) ) ;
93
+ }
92
94
return [ name , vscode . FileType . Directory ] ;
93
95
} else {
94
96
return [ name , vscode . FileType . File ] ;
@@ -131,7 +133,9 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
131
133
}
132
134
133
135
public async readFile ( uri : vscode . Uri ) : Promise < Uint8Array > {
134
- return this . _lookupAsFile ( uri ) . then ( ( file : File ) => {
136
+ // Use _lookup() instead of _lookupAsFile() so we send
137
+ // our cached mtime with the GET /doc request if we have it
138
+ return this . _lookup ( uri ) . then ( ( file : File ) => {
135
139
// Update cache entry
136
140
const uniqueId = `${ workspaceFolderOfUri ( uri ) } :${ file . fileName } ` ;
137
141
workspaceState . update ( `${ uniqueId } :mtime` , file . mtime ) ;
@@ -180,7 +184,9 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
180
184
return ;
181
185
}
182
186
const api = new AtelierAPI ( uri ) ;
183
- return this . _lookupAsFile ( uri ) . then (
187
+ // Use _lookup() instead of _lookupAsFile() so we send
188
+ // our cached mtime with the GET /doc request if we have it
189
+ return this . _lookup ( uri ) . then (
184
190
( ) => {
185
191
// Weirdly, if the file exists on the server we don't actually write its content here.
186
192
// Instead we simply return as though we wrote it successfully.
@@ -311,7 +317,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
311
317
child = entry . entries . get ( part ) ;
312
318
// If the last element of path is dotted and is one we haven't already cached as a directory
313
319
// then it is assumed to be a file.
314
- if ( ! part . includes ( "." ) || i + 1 < parts . length ) {
320
+ if ( ( ! part . includes ( "." ) || i + 1 < parts . length ) && ! child ) {
315
321
const fullName = entry . name === "" ? part : entry . fullName + "/" + part ;
316
322
child = new Directory ( part , fullName ) ;
317
323
entry . entries . set ( part , child ) ;
0 commit comments