Skip to content

Commit fbefb06

Browse files
authored
Fix linkedEditing desync (#242993)
1 parent 0a7d448 commit fbefb06

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/vs/editor/contrib/linkedEditing/browser/linkedEditing.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,15 @@ export class LinkedEditingContribution extends Disposable implements IEditorCont
300300
}
301301
}
302302

303-
// Clear existing decorations while we compute new ones
304-
this.clearRanges();
303+
if (!this._currentRequestPosition?.equals(position)) {
304+
// Get the current range of the first decoration (reference range)
305+
const currentRange = this._currentDecorations.getRange(0);
306+
// If there is no current range or the current range does not contain the new position, clear the ranges
307+
if (!currentRange?.containsPosition(position)) {
308+
// Clear existing decorations while we compute new ones
309+
this.clearRanges();
310+
}
311+
}
305312

306313
this._currentRequestPosition = position;
307314
this._currentRequestModelVersion = modelVersionId;

0 commit comments

Comments
 (0)