Skip to content

Commit

Permalink
feat: implement FakeFileSystem readdir
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed May 30, 2023
1 parent 1fb2445 commit 7c8d4d0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions demo/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,23 @@ class FakeFileSystem extends SimpleTextFileSystemProvider {
[otherModelUri.toString(true)]: 'This is another file'
}

protected async getFileContent (resource: monaco.Uri): Promise<string | undefined> {
protected override async getFileContent (resource: monaco.Uri): Promise<string | undefined> {
return this.files[resource.toString(true)]
}

protected async setFileContent (resource: monaco.Uri, content: string): Promise<void> {
protected override async setFileContent (resource: monaco.Uri, content: string): Promise<void> {
this.files[resource.toString(true)] = content
}

override async delete (): Promise<void> {
}

override async readdir (directory: monaco.Uri): Promise<[string, FileType][]> {
if (directory.path === '/tmp') {
return [['test2.js', FileType.File]]
}
return []
}
}

registerFileSystemOverlay(new FakeFileSystem())
Expand Down

0 comments on commit 7c8d4d0

Please sign in to comment.