* Called when a user cancels a diff view.
(rightDocUri: vscode.Uri)
| 190 | * Called when a user cancels a diff view. |
| 191 | */ |
| 192 | async cancelDiff(rightDocUri: vscode.Uri) { |
| 193 | const diffInfo = this.diffDocuments.get(rightDocUri.toString()); |
| 194 | if (!diffInfo) { |
| 195 | this.log(`No diff info found for ${rightDocUri.toString()}`); |
| 196 | // Even if we don't have diff info, we should still close the editor. |
| 197 | await this.closeDiffEditor(rightDocUri); |
| 198 | return; |
| 199 | } |
| 200 | |
| 201 | const rightDoc = await vscode.workspace.openTextDocument(rightDocUri); |
| 202 | const modifiedContent = rightDoc.getText(); |
| 203 | await this.closeDiffEditor(rightDocUri); |
| 204 | |
| 205 | this.onDidChangeEmitter.fire( |
| 206 | IdeDiffClosedNotificationSchema.parse({ |
| 207 | jsonrpc: '2.0', |
| 208 | method: 'ide/diffClosed', |
| 209 | params: { |
| 210 | filePath: diffInfo.originalFilePath, |
| 211 | content: modifiedContent, |
| 212 | }, |
| 213 | }), |
| 214 | ); |
| 215 | } |
| 216 | |
| 217 | private async onActiveEditorChange(editor: vscode.TextEditor | undefined) { |
| 218 | let isVisible = false; |
no test coverage detected