Skip to content

Commit fdef134

Browse files
authored
make sure auto reveal of inline input is more careful (microsoft#188390)
fixes microsoft/vscode-copilot#793
1 parent 3c6ebab commit fdef134

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,16 @@ export class InlineChatController implements IEditorContribution {
308308
this._zone.value.widget.preferredExpansionState = this._activeSession.lastExpansionState;
309309
this._zone.value.widget.value = this._activeSession.lastInput?.value ?? this._zone.value.widget.value;
310310
this._zone.value.widget.onDidChangeInput(_ => {
311-
const pos = this._zone.value.position;
312-
if (pos && this._zone.value.widget.hasFocus() && this._zone.value.widget.value) {
313-
this._editor.revealPosition(pos, ScrollType.Smooth);
311+
const start = this._zone.value.position;
312+
if (!start || !this._zone.value.widget.hasFocus() || !this._zone.value.widget.value || !this._editor.hasModel()) {
313+
return;
314+
}
315+
const nextLine = start.lineNumber + 1;
316+
if (nextLine >= this._editor.getModel().getLineCount()) {
317+
// last line isn't supported
318+
return;
314319
}
320+
this._editor.revealLine(nextLine, ScrollType.Smooth);
315321
});
316322

317323
this._showWidget(true, options.position);

0 commit comments

Comments
 (0)