mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 20:13:32 +01:00
chat: remove waitForReady (#277944)
* chat: remove `waitForReady` - Now that edit sessions are sync, we don't need to wait for them (just guard edits) as in https://github.com/microsoft/vscode-copilot/issues/16060 - I noticed `widget.onDidClear()` listeners were actually async and we do need to wait for them before we can safely make new input. Revised this to a delegate pattern. - Wait for a view model when sending chat. Also, improved Event.toPromise so it can safely be reused -- it now cleans up its own disposable from the disposable store or array after it settles. Resolves #247484 * Update src/vs/base/common/event.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -257,14 +257,14 @@ export class InlineChatController1 implements IEditorContribution {
|
||||
location.location = ChatAgentLocation.Notebook;
|
||||
}
|
||||
|
||||
const zone = _instaService.createInstance(InlineChatZoneWidget, location, undefined, { editor: this._editor, notebookEditor });
|
||||
this._store.add(zone);
|
||||
this._store.add(zone.widget.chatWidget.onDidClear(async () => {
|
||||
const clear = async () => {
|
||||
const r = this.joinCurrentRun();
|
||||
this.cancelSession();
|
||||
await r;
|
||||
this.run();
|
||||
}));
|
||||
};
|
||||
const zone = _instaService.createInstance(InlineChatZoneWidget, location, undefined, { editor: this._editor, notebookEditor }, clear);
|
||||
this._store.add(zone);
|
||||
|
||||
return zone;
|
||||
});
|
||||
@@ -1332,6 +1332,7 @@ export class InlineChatController2 implements IEditorContribution {
|
||||
defaultMode: ChatMode.Ask
|
||||
},
|
||||
{ editor: this._editor, notebookEditor },
|
||||
() => Promise.resolve(),
|
||||
);
|
||||
|
||||
result.domNode.classList.add('inline-chat-2');
|
||||
|
||||
Reference in New Issue
Block a user