Closed faldor20 closed 3 years ago
Hey @faldor20 :wave:,
Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our OpenCollective and consider backing us.
https://opencollective.com/ionide
PS.: We offer
backer
support for all backers. Don't forget to addbacker
label when you start backing us :smile:
I don't think Ionide should do this. The goal of type abbreviations is to provide a different name for something as an abstraction. Showing the implementation details of that abstraction doesn't feel right. If it's awkward to use because tooling doesn't show the implementation details, then that's probably a sign that the type alias wasn't a good choice.
You should still get a tooltip if you hover over the name of the alias itself, though.
type Doot = int -> int -> int
let f (d: Doot) = ()
Hovering over Doot
in the f
definition should probably show a tooltip like so:
type Doot = int -> int -> int
That's what VS tooltips do and it's probably the right call.
I noticed that Ionide doesn't do that today, so that would feel like the right feature request to me.
The code to do that would lie in FsAutocomplete - https://github.com/fsharp/FsAutoComplete/blob/master/src/FsAutoComplete.Core/TipFormatter.fs
The code to do that would lie in FsAutocomplete - ~https://github.com/fsharp/FsAutoComplete/blob/master/src/FsAutoComplete.Core/TipFormatter.fs~
https://github.com/fsharp/FsAutoComplete/blob/master/src/FsAutoComplete.Core/SignatureFormatter.fs
yeehaw
It's actually interesting that we don't show any tooltip for Doop
🤔
Yep, a bug in there I guess? I don't recall ever intentionally hovering over type aliases in Ionide before so I can't say.
The signature does show in a completion list though, so when you're typing out f
you'll see the correct Doop
signature as you are typing it.
I hear what your saying about aliases but let me give a great example of why it does make sense. (Though I do think just that hover working correctly would make a big difference). Say I make a type alias jobID that is an int. Internally I don't what it to be just any old int I want it to be obvious what that int is in my type definitions and when passing it into functions. And maybe at some point I might even change it from an in t to a guid or something. But when I want to cast outside received data into a jobID if I can't see the type I have to look at the implementation.
Another good example is using a few dictionary's as a simple database. An alias is great so you don't have to write out a monster type signature, but a pain because upon hovering over the variable it has no info about what it actually is.
Perhapse a more simple solution is: if a variable is just an instance of an alias type, it would show the alias and underlying type on hover. Once it's in a record or a list etc its just the alias. That way when you actually go to use the thing,( say an item in a list being mapped, or a record you have pulled an item out of) it's obvious what you're working with.
But I'll take my feature request fsautocomplete, even if it doesn't get approved, seems useful to have it for posterity
Closing it here, we have an issue for this feature request in FSAC repo.
Is your feature request related to a problem? Please describe. 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.
Describe the solution you'd like 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
I think a good idea for type annotations and intellisene displaying would be something along these lines hierarchy{Dictionary<location{id {int} list},item>} or even just one level deep like: hierarchy{Dictionary<location,item>}