-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(audoedit): add the accept
command callback
#6543
feat(audoedit): add the accept
command callback
#6543
Conversation
protected async acceptEdit(): Promise<void> { | ||
const editor = vscode.window.activeTextEditor | ||
const { activeRequest } = this | ||
if ( | ||
!editor || | ||
!activeRequest || | ||
!areSameUriDocs(editor.document, this.activeRequest?.document) | ||
) { | ||
return this.rejectEdit() | ||
} | ||
|
||
await vscode.commands.executeCommand('editor.action.inlineSuggest.hide') | ||
await editor.edit(editBuilder => { | ||
editBuilder.replace(activeRequest.codeToReplaceData.range, activeRequest.prediction) | ||
}) | ||
|
||
await this.handleDidHideSuggestion() | ||
autoeditAnalyticsLogger.markAsAccepted(activeRequest.requestId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed because it's identical to the default renderer.
@@ -545,8 +546,6 @@ export class AutoeditAnalyticsLogger { | |||
if (result?.updatedRequest) { | |||
this.writeAutoeditRequestEvent('suggested', result.updatedRequest) | |||
this.writeAutoeditRequestEvent('accepted', result.updatedRequest) | |||
|
|||
this.activeRequests.delete(result.updatedRequest.requestId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use this.activeRequests
for caching; having them around for debugging is helpful. We can change this behavior later if necessary. For now, the LRU cache size limit will ensure that stale requests are deleted.
accepted
andsuggested
telemetry events.Test plan
accepted
analytics event. The analytics events written through the telemetry logger can be found in the autoedits output channel.