Skip to content

Conversation

@SimonSiefke
Copy link
Contributor

Before:
code-lens-count-before

In the code lens controller, the old code lens models don't seem to be cleared in all cases. It seems they are only cleared if toResolve.length is greater than zero. Due to the early return, the cleanup seems missing for the case toResolve.length === 0 .

// before
private _resolveCodeLensesInViewport(): void {

    /* ... */
    if (toResolve.length === 0) {
	    return; 
    }

    /* ... */ 
    this._oldCodeLensModels.clear();
}

After:
code-lens-count-after

The change is to clear oldCodeLensModels in both cases:

// after
private _resolveCodeLensesInViewport(): void {

    /* ... */
    if (toResolve.length === 0) {
		this._oldCodeLensModels.clear();
	    return; 
    }

    /* ... */ 
    this._oldCodeLensModels.clear();
}
Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mjbvz mjbvz enabled auto-merge August 25, 2025 15:16
@vs-code-engineering vs-code-engineering bot added this to the August 2025 milestone Aug 25, 2025
@mjbvz mjbvz merged commit c0cd9a9 into microsoft:main Aug 25, 2025
17 checks passed
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Oct 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

4 participants