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
Polish query accepting #183995
Polish query accepting #183995
Conversation
We shouldn't send the same request to Copilot if the query hasn't changed. So if the query is the same, we short circut. Fixes microsoft/vscode-internalbacklog#4286 Also, when we open in chat, we should use the last accepted query, not what's in the input box. Fixes microsoft/vscode-internalbacklog#4280
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.
Disabled auto merge in case you want the optional suggestions here
@@ -93,8 +94,9 @@ class AskQuickQuestionAction extends Action2 { | |||
}); | |||
disposableStore.add(openInChat); | |||
disposableStore.add(openInChat.onChange(async () => { | |||
await this._currentSession?.openInChat(this._input!.value); | |||
await this._currentSession?.openInChat(this._lastAcceptedQuery ?? this._input!.value); |
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.
You could avoid the ! if you set a input
variable to the outer function scope
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.
will add in debt week
@@ -249,10 +253,13 @@ class InteractiveQuickPickSession extends Disposable { | |||
|
|||
async accept(query: string) { | |||
await this._model.waitForInitialization(); | |||
const requests = this._model.getRequests(); | |||
const lastRequest = requests[requests.length - 1]; | |||
if (lastRequest?.message && lastRequest?.message === query) { |
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.
The lastRequest?.message
condition is redundant
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.
will add in debt week
We shouldn't send the same request to Copilot if the query hasn't changed. So if the query is the same, we short circut.
Fixes https://github.com/microsoft/vscode-internalbacklog/issues/4286
Also, when we open in chat, we should use the last accepted query, not what's in the input box.
Fixes https://github.com/microsoft/vscode-internalbacklog/issues/4280