From d3647bf93c476807a193a1261709cf8d9a8976c1 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Fri, 17 Jan 2025 19:02:46 -0800 Subject: [PATCH] red lines above green --- .../void/browser/inlineDiffsService.ts | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts index 143e60a1..a81eefe1 100644 --- a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts +++ b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts @@ -599,7 +599,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { )); const viewZone: IViewZone = { - afterLineNumber: type === 'edit' ? diff.endLine : diff.startLine - 1, + afterLineNumber: diff.startLine - 1, heightInLines, minWidthInPx, domNode, @@ -626,6 +626,21 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { const consistentWidgetId = this._consistentItemService.addConsistentItemToURI({ uri, fn: (editor) => { + console.log('diffOriignal', diff.startLine, diff.originalStartLine, diff.type === 'deletion' && diff.originalEndLine) + + let startLine: number + let offsetLines: number + + if (diff.type === 'insertion' || diff.type === 'edit') { + startLine = diff.startLine // green start + offsetLines = 0 + } + else if (diff.type === 'deletion') { + startLine = diff.startLine - 1 + offsetLines = 1 + } + else { throw 1 } + const buttonsWidget = new AcceptRejectWidget({ editor, onAccept: () => { @@ -637,13 +652,8 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { this._metricsService.capture('Reject Diff', {}) }, diffid: diffid.toString(), - startLine: diff.startLine, - offsetLines: ( - diff.type === 'insertion' ? 0 - : diff.type === 'deletion' ? -(diff.originalEndLine - diff.originalStartLine + 1) - : diff.type === 'edit' ? (diff.endLine - diff.startLine + 1) - : 0 // not allowed - ) + startLine, + offsetLines }) return () => { buttonsWidget.dispose() } }