[ty] Avoid stale diagnostics for open files diagnostic mode by dhruvmanila · Pull Request #19273 · astral-sh/ruff (original) (raw)

Summary

This PR fixes a bug where in openFilesOnly diagnostic mode, VS Code wouldn't clean up the diagnostics even though the server asked it to by sending an empty publish diagnostics.

This is not the long-term solution but a quick fix. Ideally, the server would dynamically register for workspace diagnostics but that requires listening for didChangeConfiguration notification which I'm going to be working on with astral-sh/ty#82.

Test Plan

Before

This uses the latest stable version of ty.

Screen.Recording.2025-07-11.at.08.54.30.mov

After

This uses the debug build of ty from this PR.

Screen.Recording.2025-07-11.at.08.55.06.mov