ionide / FsAutoComplete

F# language server using Language Server Protocol
Other
417 stars 154 forks source link

Show underlying Types of alias Types #653

Open faldor20 opened 4 years ago

faldor20 commented 4 years ago

This is a mirror of my issue for the ionide vscode extension. I was told here would be a more appropriate place to ask https://github.com/ionide/ionide-vscode-fsharp/issues/1417

Its very annoying when i make types alias's for ease of documentation/domain modeling and it then completely obscures what the underlying type actually is.

I would like an option to show the underlying types of aliases both in intellisense popups/hovering and also in the inline auto-generated type annotations

Example

type id = int
type location= id list
type hierarchy= Dictionary<location,item>

I think a good idea for type annotations and intellisene displaying would be something along these lines

|    alias   |{ underlying type alias v    alias v       }
hierarchy{Dictionary<location{id {int} list},item>}

or even just one level deep like:

| alias     | {   underlying type            }   
hierarchy{Dictionary<location,item>}
baronfel commented 3 years ago

This is possible, but would be a lot of work. Currently, all tooltips are derived from the results of the checkResults.GetTooltipText API from FCS, which is pretty opinionated about resolving type aliases/abbreviations down to what their fully-resolved types are.

This could either be changed in FCS itself for this API (possibly with some kind of flag?) or we could shift our tooltip generation away from this all-in-one API and into a more custom tooltip generation logic, which is what Visual Studio does.