Skip to content

Commit

Permalink
inline chat should always render changes, even when having empty resp…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken authored Sep 4, 2024
1 parent db636a6 commit 4849ca9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,29 +758,29 @@ export class InlineChatController implements IEditorContribution {
let newPosition: Position | undefined;

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

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

} else {
// real response -> complex...
// real response -> no message
this._ui.value.zone.widget.updateStatus('');
}

const position = await this._strategy.renderChanges();
if (position) {
// if the selection doesn't start far off we keep the widget at its current position
// because it makes reading this nicer
const selection = this._editor.getSelection();
if (selection?.containsPosition(position)) {
if (position.lineNumber - selection.startLineNumber > 8) {
newPosition = position;
}
} else {
const position = await this._strategy.renderChanges();
if (position) {
// if the selection doesn't start far off we keep the widget at its current position
// because it makes reading this nicer
const selection = this._editor.getSelection();
if (selection?.containsPosition(position)) {
if (position.lineNumber - selection.startLineNumber > 8) {
newPosition = position;
}
} else {
newPosition = position;
}
}
this._showWidget(this._session.headless, false, newPosition);
Expand Down

0 comments on commit 4849ca9

Please sign in to comment.