Live mode uses chat widget rendering (#210157)

* reveal editor after making changes

* also give preview models a path component

* workaround errors in diff computer fyi @hediet

* * make live mode be a rendering mode
* render new files with the chat widget and not with a separate zone

* 💄

* fix tests
This commit is contained in:
Johannes Rieken
2024-04-11 14:43:53 +02:00
committed by GitHub
parent 0424b0b26a
commit 7b91c2d1ba
7 changed files with 84 additions and 87 deletions

View File

@@ -506,7 +506,7 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
} else if (item.kind === 'textEdit') {
for (const edit of item.edits) {
raw.edits.edits.push({
resource: session.textModelN.uri,
resource: item.uri,
textEdit: edit,
versionId: undefined
});
@@ -570,19 +570,9 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
const id = generateUuid();
const targetUri = textModel.uri;
let textModelN: ITextModel;
if (options.editMode === EditMode.Preview) {
// AI edits happen in a copy
textModelN = store.add(this._modelService.createModel(
createTextBufferFactoryFromSnapshot(textModel.createSnapshot()),
{ languageId: textModel.getLanguageId(), onDidChange: Event.None },
targetUri.with({ scheme: Schemas.vscode, authority: 'inline-chat', path: '', query: new URLSearchParams({ id, 'textModelN': '' }).toString() })
));
} else {
// AI edits happen in the actual model, keep a reference but make no copy
store.add((await this._textModelService.createModelReference(textModel.uri)));
textModelN = textModel;
}
// AI edits happen in the actual model, keep a reference but make no copy
store.add((await this._textModelService.createModelReference(textModel.uri)));
const textModelN = textModel;
// create: keep a snapshot of the "actual" model
const textModel0 = store.add(this._modelService.createModel(