Skip to content

Commit 4849ca9

Browse files
authored
inline chat should always render changes, even when having empty responses or errors (#227573)
fixes microsoft/vscode-copilot-release#1524
1 parent db636a6 commit 4849ca9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -758,29 +758,29 @@ export class InlineChatController implements IEditorContribution {
758758
let newPosition: Position | undefined;
759759

760760
if (response.result?.errorDetails) {
761-
//
761+
// error -> no message, errors are shown with the request
762762

763763
} else if (response.response.value.length === 0) {
764764
// empty -> show message
765765
const status = localize('empty', "No results, please refine your input and try again");
766766
this._ui.value.zone.widget.updateStatus(status, { classes: ['warn'] });
767767

768768
} else {
769-
// real response -> complex...
769+
// real response -> no message
770770
this._ui.value.zone.widget.updateStatus('');
771+
}
771772

772-
const position = await this._strategy.renderChanges();
773-
if (position) {
774-
// if the selection doesn't start far off we keep the widget at its current position
775-
// because it makes reading this nicer
776-
const selection = this._editor.getSelection();
777-
if (selection?.containsPosition(position)) {
778-
if (position.lineNumber - selection.startLineNumber > 8) {
779-
newPosition = position;
780-
}
781-
} else {
773+
const position = await this._strategy.renderChanges();
774+
if (position) {
775+
// if the selection doesn't start far off we keep the widget at its current position
776+
// because it makes reading this nicer
777+
const selection = this._editor.getSelection();
778+
if (selection?.containsPosition(position)) {
779+
if (position.lineNumber - selection.startLineNumber > 8) {
782780
newPosition = position;
783781
}
782+
} else {
783+
newPosition = position;
784784
}
785785
}
786786
this._showWidget(this._session.headless, false, newPosition);

0 commit comments

Comments
 (0)