(uri: URI, edits: Edit[], content: string)
| 103 | } |
| 104 | |
| 105 | async applyEdits(uri: URI, edits: Edit[], content: string) { |
| 106 | switch (uri.scheme) { |
| 107 | case RemoteDocuments.scheme: |
| 108 | try { |
| 109 | if (!RemoteDocuments.nonce) { |
| 110 | RemoteDocuments.nonce = crypto.randomUUID(); |
| 111 | } |
| 112 | const result = jsonc.applyEdits(content, edits); |
| 113 | const eof = `EOF-${RemoteDocuments.nonce}`; |
| 114 | await this.shellServer.exec(`cat <<'${eof}' >${uri.path} |
| 115 | ${result} |
| 116 | ${eof} |
| 117 | `); |
| 118 | } catch (err) { |
| 119 | console.log(err); // XXX |
| 120 | } |
| 121 | break; |
| 122 | default: |
| 123 | throw new Error(`Unsupported scheme: ${uri.toString()}`); |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | export class AllDocuments implements Documents { |
nothing calls this directly
no test coverage detected