Skip to content

Commit 5b2ecd2

Browse files
committed
rm and append dom node
1 parent b07469d commit 5b2ecd2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
5959
private followupsDisposables = this._register(new DisposableStore());
6060

6161
private _inputEditor!: CodeEditorWidget;
62+
private _inputEditorElement!: HTMLElement;
63+
6264
public get inputEditor() {
6365
return this._inputEditor;
6466
}
@@ -148,8 +150,14 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
148150
this.history.add(editorValue);
149151
}
150152

151-
this._inputEditor.focus();
153+
const domNode = this._inputEditor.getDomNode();
154+
if (!domNode) {
155+
return;
156+
}
157+
this._inputEditorElement.removeChild(domNode);
152158
this._inputEditor.setValue('');
159+
this._inputEditorElement.appendChild(domNode);
160+
this._inputEditor.focus();
153161
}
154162

155163
render(container: HTMLElement, initialValue: string, widget: IChatWidget) {
@@ -181,8 +189,8 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
181189
options.suggest = { showIcons: false };
182190
options.scrollbar = { ...(options.scrollbar ?? {}), vertical: 'hidden' };
183191

184-
const inputEditorElement = dom.append(inputContainer, $('.interactive-input-editor'));
185-
this._inputEditor = this._register(scopedInstantiationService.createInstance(CodeEditorWidget, inputEditorElement, options, getSimpleCodeEditorWidgetOptions()));
192+
this._inputEditorElement = dom.append(inputContainer, $('.interactive-input-editor'));
193+
this._inputEditor = this._register(scopedInstantiationService.createInstance(CodeEditorWidget, this._inputEditorElement, options, getSimpleCodeEditorWidgetOptions()));
186194

187195
this._register(this._inputEditor.onDidChangeModelContent(() => {
188196
const currentHeight = Math.min(this._inputEditor.getContentHeight(), INPUT_EDITOR_MAX_HEIGHT);

0 commit comments

Comments
 (0)