You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using delegate keyword breaks semantic highlighting #16982
Area-VS-EditorVS editor support for F# code, not covered elsewhereBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.help wanted
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.
Removing AI-thinks-windows-only — semantic classification is testable via FSharp.Compiler.Service's GetSemanticClassification API on any OS.
Confirmed still reproducing on d507366 (2026-04-01), F# 11.0, FSharp.Core 11.0.100:
typeResolvingErrorReport=delegateofint*System.Int32*System.Int32*int->unit
```
FCS classification output (sorted by position):
```
Col 5-25 Type=Delegate Text='ResolvingErrorReport'
Col 28-87 Type=Method Text='delegateofint*System.Int32*System.Int32*int->unit'
Col 46-58 Type=ValueType Text='System.Int32'
Col 61-73 Type=ValueType Text='System.Int32'
The entire delegate signature (col 28–87) is classified as Method. The fully-qualified System.Int32 references get their own ValueType classification that overrides the Method range — but bare int keywords do not get separate ValueType classification. This causes int and System.Int32 to render in different colors despite being the same type, exactly as shown in the issue screenshots.
@auduchinok's hypothesis about synthetic members from the delegate representation seems correct — the Invoke method generated for the delegate type is what produces the Method classification spanning the whole signature.
Area-VS-EditorVS editor support for F# code, not covered elsewhereBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.help wanted
Activity
auduchinok commentedon Apr 3, 2024
My guess is it may be related to converting the
delegaterepresentation 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.github-actions commentedon Apr 1, 2026
🤖 This is an automated response from Repo Assist.
Removing
AI-thinks-windows-only— semantic classification is testable via FSharp.Compiler.Service'sGetSemanticClassificationAPI on any OS.Confirmed still reproducing on
d507366(2026-04-01), F# 11.0, FSharp.Core 11.0.100:The entire delegate signature (col 28–87) is classified as
Method. The fully-qualifiedSystem.Int32references get their ownValueTypeclassification that overrides theMethodrange — but bareintkeywords do not get separateValueTypeclassification. This causesintandSystem.Int32to render in different colors despite being the same type, exactly as shown in the issue screenshots.@auduchinok's hypothesis about synthetic members from the delegate representation seems correct — theInvokemethod generated for the delegate type is what produces theMethodclassification spanning the whole signature.