Skip to content

Conversation

@muqiuhan
Copy link
Contributor

@muqiuhan muqiuhan commented Dec 5, 2025

Description

This is some simple optimization work for #17488. On the basis of optimizing the style, the standard path format has been retained ^_^

image image image

Checklist

  • Test cases added

  • Performance benchmarks added in case of performance changes

  • Release notes entry updated:

    Please make sure to add an entry with short succinct description of the change as well as link to this pull request to the respective release notes file, if applicable.

    Release notes files:

    • If anything under src/Compiler has been changed, please make sure to make an entry in docs/release-notes/.FSharp.Compiler.Service/<version>.md, where <version> is usually "highest" one, e.g. 42.8.200
    • If language feature was added (i.e. LanguageFeatures.fsi was changed), please add it to docs/release-notes/.Language/preview.md
    • If a change to FSharp.Core was made, please make sure to edit docs/release-notes/.FSharp.Core/<version>.md where version is "highest" one, e.g. 8.0.200.

    Information about the release notes entries format can be found in the documentation.
    Example:

    If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/10.0.200.md

@muqiuhan muqiuhan force-pushed the feat/enhance-diagnostic branch from 1afdee9 to bd92cbf Compare December 6, 2025 03:09
// 'true' for "canSuggestNames" is passed last here because we want to report suggestions in fsc.exe and fsi.exe, just not in regular IDE usage.
let diagnostics = CollectFormattedDiagnostics(tcConfig, severity, diagnostic, true)

let renderRich (details: FormattedDiagnosticDetailedInfo) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have grown to a non-trivial amount of logic now.
This should now have dedicated tests showing the various aspects of the feature in place.

(as an inspiration, look how existing "help" function exercise the compiler to print help and then assert on exact matching compiler output - that might work well. Other test suites typically do not focus on the formatting of diagnostics and instead use F# data to assert them, so e.g. ComponentTests style will not be much applicable for this feature)

// 'true' for "canSuggestNames" is passed last here because we want to report suggestions in fsc.exe and fsi.exe, just not in regular IDE usage.
let diagnostics = CollectFormattedDiagnostics(tcConfig, severity, diagnostic, true)

let renderRich (details: FormattedDiagnosticDetailedInfo) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this does not need any environmental information and it only takes the details object, you can also consider extracting this to a separate standalone function and test it in isolation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants