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

Method acceptDiff

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

* User accepts the changes in a diff view. Does not apply changes.

(rightDocUri: vscode.Uri)

Source from the content-addressed store, hash-verified

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.

Callers 1

activateFunction · 0.95

Calls 2

closeDiffEditorMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected