Add symbol and type highlighting to F# diagnostics - #20097
Conversation
This comment has been minimized.
This comment has been minimized.
81e1ec1 to
77b7272
Compare
This comment has been minimized.
This comment has been minimized.
ef5fe96 to
4bb1086
Compare
|
This is ready. |
| <Link>FSStrings.resx</Link> | ||
| <LogicalName>FSStrings.resources</LogicalName> | ||
| </EmbeddedResource> | ||
| <Compile Include="Utilities\NullHelpers.fs" CompileOrder="CompileFirst" /> |
There was a problem hiding this comment.
Why is the CompileOrder necessary?
There was a problem hiding this comment.
Otherwise RichText is not available in the generated error helpers.
| [<Fact>] | ||
| let ``Can get help for FSComp.SR.considerUpcast`` () = | ||
| match FSharp.Compiler.Interactive.FsiHelp.Logic.Quoted.tryGetHelp <@ FSComp.SR.considerUpcast @> with | ||
| match FSharp.Compiler.Interactive.FsiHelp.Logic.Quoted.tryGetHelp <@ (FSComp.SR.considerUpcast: string * string -> int * string) @> with |
There was a problem hiding this comment.
Why do we have to type annotate now?
Is this change source-breaking for some code relying on type inference?
There was a problem hiding this comment.
An AI-generated response:
Why the annotation: FSComp.txt entries with %s holes now generate two overloads (string and RichText). The test uses the accessor as a first-class value in a quotation, which F# only allows for non-overloaded methods — without the annotation it fails with FS0503: ... 'considerUpcast' taking 1 arguments is not accessible ... All accessible versions take 2 arguments. The annotation picks the string overload.
Not source-breaking for consumers: the generated type is type internal SR, so the overloads are invisible outside the assembly, and they're opt-in per resource file (true, set only for FSComp.txt — FSIstrings generates none). In-repo cost is 5 type annotations plus this quotation.
What is breaking: members moved from TaggedText[] to RichText, and FormatLayout, FormatLayoutWithConstraints, GetReturnTypeLayout were renamed to the …RichText forms — source- and binary-breaking for tooling.
Non-AI: I expect tools like Ionide and Rider will update usages for RichText, like we always do it when FCS updates.
This comment has been minimized.
This comment has been minimized.
|
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
c1d1580 to
a048ed5
Compare
|
🔍 Tooling Safety Check — Affects-Bootstrap, Affects-Build-Infra, Affects-Compiler-Output
|
Implements highlighting for symbols and types in diagnostic messages to be used by IDEs and tools like F# Interactive.
To make it possible, this PR introduces
RichTexttype which wrapsTaggedText[]uses and making the code simpler to work with in existing FCS APIs like tooltips.The FSComp helpers generation is changed in a way that the same format works without changes, and only an additional
RichTextflag is needed in the fsproj.