Using `delegate` keyword breaks semantic highlighting
Microsoft Visual Studio Enterprise 2022 Version 17.11.0 Preview 1.0 [34801.192.main] VisualStudio.17.IntPreview/17.11.0-pre.1.0+34801.192.main
Visual F# Tools 17.10.0-dev Microsoft Visual F# Tools
The screenshot above was done custom-built .vsix for the nullness feature branch. For a regular preview VS, it is differently wrong:
Microsoft Visual Studio Enterprise 2022
Version 17.10.0 Preview 2.0
VisualStudio.17.Preview/17.10.0-pre.2.0+34707.107
Visual F# Tools 17.10.0-beta.24127.3+b57dee7cec971021547a7b8a36a46d7271fea99e Microsoft Visual F# Tools
This is self-contained code to reproduce this:
[<RequireQualifiedAccess>]
type ErrorReportType =
| Warning
| Error
type ResolvingErrorReport = delegate of ErrorReportType * int * string -> unit
Another snippet demonstrating this is clearly wrong is repeating the same type more types, yet getting difference in the color:
type ResolvingErrorReport = delegate of int * System.Int32 * System.Int32 * int -> unit
My guess is it may be related to converting the delegate representation to another shape during the type checking (or even during the parsing). I think there're additional members added to the tree and then their symbols are reported during the type checking. If this is true, then a fix could be as follows: mark ranges of these members synthetic and then ignore symbols with synthetic ranges during semantic highlighting.