Skip to content

Commit b578213

Browse files
authored
reveal inline chat when typing inside of it (microsoft#185648)
fixes microsoft/vscode-copilot-release#226
1 parent c248f9e commit b578213

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
1616
import { EditOperation } from 'vs/editor/common/core/editOperation';
1717
import { Position } from 'vs/editor/common/core/position';
1818
import { IRange, Range } from 'vs/editor/common/core/range';
19-
import { IEditorContribution } from 'vs/editor/common/editorCommon';
19+
import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon';
2020
import { ModelDecorationOptions, createTextBufferFactoryFromSnapshot } from 'vs/editor/common/model/textModel';
2121
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorker';
2222
import { IModelService } from 'vs/editor/common/services/model';
@@ -309,9 +309,16 @@ export class InlineChatController implements IEditorContribution {
309309

310310
this._zone.value.widget.updateSlashCommands(this._activeSession.session.slashCommands ?? []);
311311
this._zone.value.widget.placeholder = this._getPlaceholderText();
312-
this._zone.value.widget.value = this._activeSession.lastInput?.value ?? this._zone.value.widget.value;
313312
this._zone.value.widget.updateInfo(this._activeSession.session.message ?? localize('welcome.1', "AI-generated code may be incorrect"));
314313
this._zone.value.widget.preferredExpansionState = this._activeSession.lastExpansionState;
314+
this._zone.value.widget.value = this._activeSession.lastInput?.value ?? this._zone.value.widget.value;
315+
this._zone.value.widget.onDidChangeInput(_ => {
316+
const pos = this._zone.value.position;
317+
if (pos && this._zone.value.widget.hasFocus() && this._zone.value.widget.value) {
318+
this._editor.revealPosition(pos, ScrollType.Smooth);
319+
}
320+
});
321+
315322
this._showWidget(false);
316323

317324
this._sessionStore.add(this._editor.onDidChangeModel((e) => {

0 commit comments

Comments
 (0)