| 126 | } |
| 127 | |
| 128 | export class AllDocuments implements Documents { |
| 129 | |
| 130 | constructor(private documents: Record<string, Documents>) { |
| 131 | } |
| 132 | |
| 133 | async readDocument(uri: URI) { |
| 134 | const documents = this.documents[uri.scheme]; |
| 135 | if (!documents) { |
| 136 | throw new Error(`Unsupported scheme: ${uri.toString()}`); |
| 137 | } |
| 138 | return documents.readDocument(uri); |
| 139 | } |
| 140 | |
| 141 | async applyEdits(uri: URI, edits: Edit[], content: string) { |
| 142 | const documents = this.documents[uri.scheme]; |
| 143 | if (!documents) { |
| 144 | throw new Error(`Unsupported scheme: ${uri.toString()}`); |
| 145 | } |
| 146 | return documents.applyEdits(uri, edits, content); |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | export function createDocuments(fileHost: FileHost, shellServer?: ShellServer): Documents { |
| 151 | const documents: Record<string, Documents> = { |
nothing calls this directly
no outgoing calls
no test coverage detected