use better file create mode for lightweight mode, fix issue with hidden/visible extra button bar (#199151)

This commit is contained in:
Johannes Rieken
2023-11-27 12:39:18 +01:00
committed by GitHub
parent b5f1966e92
commit e6b2fd82c1
2 changed files with 7 additions and 4 deletions

View File

@@ -607,6 +607,7 @@ export class LiveStrategy3 extends EditModeStrategy {
private readonly _store: DisposableStore = new DisposableStore();
private readonly _sessionStore: DisposableStore = new DisposableStore();
private readonly _previewZone: Lazy<InlineChatFileCreatePreviewWidget>;
private readonly _ctxCurrentChangeHasDiff: IContextKey<boolean>;
private readonly _ctxCurrentChangeShowsDiff: IContextKey<boolean>;
@@ -631,6 +632,8 @@ export class LiveStrategy3 extends EditModeStrategy {
this._ctxCurrentChangeShowsDiff = CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF.bindTo(contextKeyService);
this._modifiedRangesDecorations = this._editor.createDecorationsCollection();
this._previewZone = new Lazy(() => _instaService.createInstance(InlineChatFileCreatePreviewWidget, _editor));
}
override dispose(): void {
@@ -939,10 +942,10 @@ export class LiveStrategy3 extends EditModeStrategy {
override async renderChanges(response: ReplyResponse) {
if (response.untitledTextModel) {
this._zone.widget.showCreatePreview(response.untitledTextModel);
if (response.untitledTextModel && !response.untitledTextModel.isDisposed()) {
this._previewZone.value.showCreation(this._session.wholeRange.value.getStartPosition().delta(-1), response.untitledTextModel);
} else {
this._zone.widget.hideCreatePreview();
this._previewZone.value.hide();
}
return await this._showDiff(true, false);