Fsharp: Tooltip: show concrete generic parameters

Created on 23 Apr 2017  路  8Comments  路  Source: dotnet/fsharp

image

I would like to see what 'T refers to in this context.

For comparison, I think C# handles this quite nice wrt anonymous types:

image

If you use non-anonymous classes, then the parameters are directly filled in:

image

But imo, for F#, i would prefer it if it would show the method signature without replacing the generic parameters and then showed the values of the parameters below.

Area-IDE Language Service

Most helpful comment

What I would prefer:

image

All 8 comments

What I would prefer:

image

I think what you suggested would be great. It's really easy to have 'T be a long type, but having it at the bottom like that would alleviate the pain of really really long type signatures on a single line.

I like this suggestion very much. I can help with the FCS work to get the FSharpType values for the type instantiations available.

I can help with the FCS work to get the FSharpType values for the type instantiations available.

I started taking a look at this since it's something I've been meaning to do for a long time and I know it's a really awful bit of work in the compiler service (which is why it hasn't been done). The code that tracks instantiations and their "pretty" form where we get rid of type inference variables in the IDE is a mess.

Anyway, here's a link to the branch - it will likely be a while before it is ready to even look at, I'm just including the link for my own reference

https://github.com/Microsoft/visualfsharp/compare/master...dsyme:gp1?expand=1

@0x53A @cartermp Am I right in thinking we would only want this for quick info (i.e. tooltips)?

For example, should "x.Foo" where "x" has generic type show explicit type variable instantiations in the item descriptions in the completion list for "Foo" ? Currently I'm assuming not.

Right now the items in the declaration list show the substituted types

let x = ResizeArray<int>()

x.ToArray // shows a return type of int[]

So as things stand with the prototype PR we will only show explicit instantiations for generic method, F# functions and F# operators. We won't show explicit instantiations for type parameters arising from generic types - instead these are explicitly substituted. I think this is OK but a little inconsistent

Yes, I'm thinking that only QuickInfo makes sense. At least for now. We can see how we feel once this is in for QuickInfo.

Close as this has been merged

Was this page helpful?
0 / 5 - 0 ratings