Skip to content

Commit

Permalink
Fix deletion decoration logic in inline diff view (#238377)
Browse files Browse the repository at this point in the history
fix deletion decoration
  • Loading branch information
benibenj authored Jan 22, 2025
1 parent d6d62da commit 63c3204
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { EditorOption } from '../../../../../common/config/editorOptions.js';
import { Range } from '../../../../../common/core/range.js';
import { AbstractText } from '../../../../../common/core/textEdit.js';
import { DetailedLineRangeMapping } from '../../../../../common/diff/rangeMapping.js';
import { IModelDeltaDecoration, ITextModel } from '../../../../../common/model.js';
import { EndOfLinePreference, IModelDeltaDecoration, ITextModel } from '../../../../../common/model.js';
import { ModelDecorationOptions } from '../../../../../common/model/textModel.js';
import { InlineDecoration, InlineDecorationType } from '../../../../../common/viewModel.js';
import { classNames } from './utils.js';
Expand Down Expand Up @@ -184,6 +184,7 @@ export class OriginalEditorInlineDiffView extends Disposable {
for (const i of m.innerChanges || []) {
// Don't show empty markers outside the line range
if (m.original.contains(i.originalRange.startLineNumber)) {
const replacedText = this._originalEditor.getModel()?.getValueInRange(i.originalRange, EndOfLinePreference.LF);
originalDecorations.push({
range: i.originalRange,
options: {
Expand All @@ -193,7 +194,7 @@ export class OriginalEditorInlineDiffView extends Disposable {
'inlineCompletions-char-delete',
i.originalRange.isSingleLine() && diff.mode === 'ghostText' && 'single-line-inline',
i.originalRange.isEmpty() && 'empty',
((i.originalRange.isEmpty() || diff.mode === 'deletion') && showEmptyDecorations && !useInlineDiff) && 'diff-range-empty'
((i.originalRange.isEmpty() || diff.mode === 'deletion' && replacedText === '\n') && showEmptyDecorations && !useInlineDiff) && 'diff-range-empty'
),
inlineClassName: useInlineDiff ? classNames('strike-through', 'inlineCompletions') : null,
zIndex: 1
Expand Down

0 comments on commit 63c3204

Please sign in to comment.