Change:
}); }); <ins> suite('BidirectionalMap', () => { test('should set and get values correctly', () => { const map = new BidirectionalMap<string, number>(); map.set('one', 1); map.set('two', 2); map.set('three', 3); assert.strictEqual(map.get('one'), 1); assert.strictEqual(map.get('two'), 2); assert.strictEqual(map.get('three'), 3); }); test('should get keys by value correctly', () => { const map = new BidirectionalMap<string, number>(); map.set('one', 1); map.set('two', 2); map.set('three', 3); assert.strictEqual(map.getKey(1), 'one'); assert.strictEqual(map.getKey(2), 'two'); assert.strictEqual(map.getKey(3), 'three'); }); test('should delete values correctly', () => { const map = new BidirectionalMap<string, number>(); map.set('one', 1); map.set('two', 2); map.set('three', 3); assert.strictEqual(map.delete('one'), true); assert.strictEqual(map.get('one'), undefined); assert.strictEqual(map.getKey(1), undefined); assert.strictEqual(map.delete('two'), true); assert.strictEqual(map.get('two'), undefined); assert.strictEqual(map.getKey(2), undefined); assert.strictEqual(map.delete('three'), true); assert.strictEqual(map.get('three'), undefined); assert.strictEqual(map.getKey(3), undefined); }); test('should handle non-existent keys correctly', () => { const map = new BidirectionalMap<string, number>(); map.set('one', 1); map.set('two', 2); map.set('three', 3); assert.strictEqual(map.get('four'), undefined); assert.strictEqual(map.getKey(4), undefined); assert.strictEqual(map.delete('four'), false); }); test('should handle forEach correctly', () => { const map = new BidirectionalMap<string, number>(); map.set('one', 1); map.set('two', 2); map.set('three', 3); const keys: string[] = []; const values: number[] = []; map.forEach((value, key) => { keys.push(key); values.push(value); }); assert.deepStrictEqual(keys, ['one', 'two', 'three']); assert.deepStrictEqual(values, [1, 2, 3]); }); test('should handle clear correctly', () => { const map = new BidirectionalMap<string, number>(); map.set('one', 1); map.set('two', 2); map.set('three', 3); map.clear(); assert.strictEqual(map.get('one'), undefined); assert.strictEqual(map.get('two'), undefined); assert.strictEqual(map.get('three'), undefined); assert.strictEqual(map.getKey(1), undefined); assert.strictEqual(map.getKey(2), undefined); assert.strictEqual(map.getKey(3), undefined); }); }); </ins>

Discussion:
I wonder why all of line 14 becomes gray (i.e. unused) after I remove line 13. I guess this is because the decorations of line 13 get applied to line 14 which becomes line 13. I think we can improve this by listening to text edits and updating the cache accordingly - when a line is deleted, its decorations should be deleted too and not just applied to whatever lines becomes the deleted line. ! Another example: !
This is for TypeScript: ! And this for JSON: ! This indicates that this is indeed a problem of TypeScript, and not diagnostics in general (
how about a small TS repro sample?
!
Looks pretty normal here. Also just checked with that TypeScript uses plain diagnostics. Can be because of another setting/feature that interfers here? https://user-
Interesting. It also happens when I reset all my settings, but it only happens in the VS Code repository (but there every single time)...
I can't reproduce any problems when there is a single diagnostic present. Having a single diagnostic updates great: Using the following sample in an untitled file in the repo: ts /
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See in the project root for license information. *
-------------/ const x = 3; ('' x + '' / 3); https://user- However, when removing the trailing such that also creates a diagnostic, I can see that the squiggle gets out of sync. I suspect that is constantly updating its diagnostic, while is not. Most likely, the fact that updates its diagnostic results in firing and the re-reading the markers from it and re-applying them. The marker goes to the right spot since it was newly refreshed by , but the marker goes to its original spot since didn't update it: https://user- To tackle this and only update the decorations for a certain diagnostics provider, the events would need to be more fine-grained and then could selectively update decorations by owner.
That's a nice find!
A cheap solution here would be for markers to record a model version id at the time they are set in the marker service. The could then read the markers and recreate squiggles only for the markers which are "fresh".
Yeah, that will work but there is no guarantee for this - since markers can be pushed for any resource.

Tho, in this case it will help
adds (which can be undefined tho)
Added the version to markers, un-assigning myself to leave the remaining work to