Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using delegate keyword breaks semantic highlighting #16982

Open
T-Gro opened this issue Apr 3, 2024 · 1 comment
Open

Using delegate keyword breaks semantic highlighting #16982

T-Gro opened this issue Apr 3, 2024 · 1 comment
Labels
Area-VS-Editor VS editor support for F# code, not covered elsewhere Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone

Comments

@T-Gro
Copy link
Member

T-Gro commented Apr 3, 2024

image

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:

image
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

image

@github-actions github-actions bot added this to the Backlog milestone Apr 3, 2024
@auduchinok
Copy link
Member

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.

@abonie abonie added Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Area-VS-Editor VS editor support for F# code, not covered elsewhere and removed Needs-Triage labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VS-Editor VS editor support for F# code, not covered elsewhere Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Projects
Status: New
Development

No branches or pull requests

3 participants