MCPcopy Create free account
hub / github.com/anus-dev/ANUS / cancelDiff

Method cancelDiff

packages/vscode-ide-companion/src/diff-manager.ts:192–215  ·  view source on GitHub ↗

* Called when a user cancels a diff view.

(rightDocUri: vscode.Uri)

Source from the content-addressed store, hash-verified

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;

Callers 1

activateFunction · 0.95

Calls 2

closeDiffEditorMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected