| 276 | } |
| 277 | |
| 278 | export class HostWithDocumentsStore implements Host { |
| 279 | defaultHost = new DefaultHost() |
| 280 | constructor(public documents: TextDocuments<TextDocument>) {} |
| 281 | readFileSync(path: string) { |
| 282 | const uri = URL_file(path) |
| 283 | const doc = this.documents.get(uri) |
| 284 | if (doc) { |
| 285 | return doc.getText() |
| 286 | } |
| 287 | return this.defaultHost.readFileSync(path) |
| 288 | } |
| 289 | existsSync(path: string) { |
| 290 | return this.defaultHost.existsSync(path) |
| 291 | } |
| 292 | readdirSync(path: string) { |
| 293 | return this.defaultHost.readdirSync(path) |
| 294 | } |
| 295 | globSync(pattern: string) { |
| 296 | return this.defaultHost.globSync(pattern) |
| 297 | } |
| 298 | writeFileSync(path: string, contents: string) { |
| 299 | return this.defaultHost.writeFileSync(path, contents) |
| 300 | } |
| 301 | get paths() { |
| 302 | return this.defaultHost.paths |
| 303 | } |
| 304 | } |
nothing calls this directly
no outgoing calls
no test coverage detected