Skip to content

Commit e0355db

Browse files
authored
fix: don't render a deletion view zone for created files (microsoft#233243)
1 parent 5074f2c commit e0355db

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,18 @@ export class ChatEditorController extends Disposable implements IEditorContribut
246246
const domNode = document.createElement('div');
247247
domNode.className = 'chat-editing-original-zone view-lines line-delete monaco-mouse-cursor-text';
248248
const result = renderLines(source, renderOptions, decorations, domNode);
249-
const viewZoneData: IViewZone = {
250-
afterLineNumber: diffEntry.modified.startLineNumber - 1,
251-
heightInLines: result.heightInLines,
252-
domNode,
253-
ordinal: 50000 + 2 // more than https://github.com/microsoft/vscode/blob/bf52a5cfb2c75a7327c9adeaefbddc06d529dcad/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.ts#L42
254-
};
255-
256-
this._viewZones.push(viewZoneChangeAccessor.addZone(viewZoneData));
249+
250+
const isCreatedContent = decorations.length === 1 && decorations[0].range.isEmpty() && decorations[0].range.startLineNumber === 1;
251+
if (!isCreatedContent) {
252+
const viewZoneData: IViewZone = {
253+
afterLineNumber: diffEntry.modified.startLineNumber - 1,
254+
heightInLines: result.heightInLines,
255+
domNode,
256+
ordinal: 50000 + 2 // more than https://github.com/microsoft/vscode/blob/bf52a5cfb2c75a7327c9adeaefbddc06d529dcad/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.ts#L42
257+
};
258+
259+
this._viewZones.push(viewZoneChangeAccessor.addZone(viewZoneData));
260+
}
257261
}
258262

259263
this._decorations.set(modifiedDecorations);

0 commit comments

Comments
 (0)