fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Nameof is not classified in generic form or pattern form

Open cartermp opened this issue 5 years ago • 5 comments

Latest dogfood:

image

This should be blue.

cartermp avatar Aug 27 '20 20:08 cartermp

image

cartermp avatar Aug 27 '20 20:08 cartermp

@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 avatar Aug 27 '20 22:08 cartermp

@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.

cartermp avatar Sep 01 '20 04:09 cartermp

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

abelbraaksma avatar Sep 01 '20 12:09 abelbraaksma

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. 😺

am11 avatar Sep 15 '20 21:09 am11