Fix #16360: stop duplicating editor diagnostics (revert Roslyn workaround)#19812
Fix #16360: stop duplicating editor diagnostics (revert Roslyn workaround)#19812T-Gro wants to merge 5 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
T-Gro
left a comment
There was a problem hiding this comment.
LGTM – clean revert of the workaround now that Roslyn handles the diagnostics correctly. The ExceptWith logic is the right way to deduplicate, and the new tests cover the key scenarios well.
Two minor suggestions (non-blocking):
-
Rename the HACK methods: Now that the workaround is gone, the TODO comments explaining the HACK names were removed, but the method names still carry the
_HACK_PLEASE_REFER_TO_COMMENT_INSIDEsuffix. Consider renaming them back to their original names (e.g.VerifyDiagnosticBetweenMarkers,VerifyErrorBetweenMarkers,VerifyErrorAtMarker) since the hack is no longer needed. -
Warning not duplicated across passes test: The source
let x = 42at module level doesn't produce any warnings (it's a public binding), soallWarningsis always empty and the assertion trivially passes. Consider using source that actually emits a warning (e.g.open Systemwithout using anything from it, or a private unused binding) to make the test meaningful.
❗ Release notes required
Warning No PR link found in some release notes, please consider adding it.
|
The workaround referenced in #15982 is no longer in place, so the *_HACK_PLEASE_REFER_TO_COMMENT_INSIDE methods are now identical to their non-suffixed counterparts. Drop the duplicate definitions and route the call sites to the existing VerifyErrorBetweenMarkers / VerifyErrorAtMarker helpers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes #16360.
Diagnostic messages produced by the F# editor analyzer were appearing twice in Visual Studio (once per analyzer pass), and the long-standing workaround for that (#15982) was suppressing duplicates in the analyzer itself.
With the underlying Roslyn duplication no longer occurring, the workaround is unnecessary. Removing it:
1diagnostic instead of2,_HACK_PLEASE_REFER_TO_COMMENT_INSIDEtest helpers, which are now identical to their normal counterparts.A failing test was added first to lock in the expected single-diagnostic behavior, then the workaround was reverted, then the duplicated helpers were collapsed.