dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.9k stars 782 forks source link

Nameof is not classified in generic form or pattern form #10026

Open cartermp opened 4 years ago

cartermp commented 4 years ago

Latest dogfood:

image

This should be blue.

cartermp commented 4 years ago

image

cartermp commented 4 years ago

@dsyme @TIHan the issue here is that nameof in either case is not actually in the captured name resolutions.

For both of these examples:

type C<'TType>() =
    static member Beef = nameof<'TType>

let rec f (s: string) =
    match s with
    | nameof f -> () 
    | _ -> ()

I get name resolutions for the 'TType and f that I'm taking a name of, but not nameof itself.

cartermp commented 4 years ago

@dsyme I bumped this out of low priority. Colors have significance in the editor and by not being accurate here we're effectively misleading folks. I suspect this will get a lot of pings from people who start to use nameof prolifically in a larger codebase. We should fix this.

abelbraaksma commented 4 years ago

This is related: https://github.com/dotnet/fsharp/issues/7826 (but not the same, that issue is caused by incorrect preview feature parsing).

am11 commented 4 years ago

While reading this thread, noticed the syntax highlight disparity between GitHub markdown's F# code rendering and VS Code. Opened a PR for it to use the same grammar as VS Code: https://github.com/github/linguist/pull/5011. 😺