* User accepts the changes in a diff view. Does not apply changes.
(rightDocUri: vscode.Uri)
| 164 | * User accepts the changes in a diff view. Does not apply changes. |
| 165 | */ |
| 166 | async acceptDiff(rightDocUri: vscode.Uri) { |
| 167 | const diffInfo = this.diffDocuments.get(rightDocUri.toString()); |
| 168 | if (!diffInfo) { |
| 169 | this.log(`No diff info found for ${rightDocUri.toString()}`); |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | const rightDoc = await vscode.workspace.openTextDocument(rightDocUri); |
| 174 | const modifiedContent = rightDoc.getText(); |
| 175 | await this.closeDiffEditor(rightDocUri); |
| 176 | |
| 177 | this.onDidChangeEmitter.fire( |
| 178 | IdeDiffAcceptedNotificationSchema.parse({ |
| 179 | jsonrpc: '2.0', |
| 180 | method: 'ide/diffAccepted', |
| 181 | params: { |
| 182 | filePath: diffInfo.originalFilePath, |
| 183 | content: modifiedContent, |
| 184 | }, |
| 185 | }), |
| 186 | ); |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Called when a user cancels a diff view. |
no test coverage detected