Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

[js code hints] Parameter hinting does not show all variants of an overloaded function. #3765

Closed
RaymondLim opened this issue May 9, 2013 · 7 comments

Comments

@RaymondLim
Copy link
Contributor

  1. In a js file type $('div').height(.
  2. Press Ctrl-Space to bring up parameter hinting.

Result: You see height()->number and the other overloaded version height(number)->jQuery.fn is not shown.

@peterflynn
Copy link
Member

Seems closely related to #3684

@RaymondLim
Copy link
Contributor Author

Yes, it's related. But this one is to help users with parameters of a specific overloaded function and #3684 has to do with chaining.

@RaymondLim
Copy link
Contributor Author

A solution for #3684 may or may not fix this issue. To fix this issue we may have to consider showing multiple hints (one for each variant) instead of just showing one with "?" as we currently have. Consider for $().data that has the following four variants:

data(key:string, value?:?)
data(obj:Object)
data(key:string)
data()

Can we combine them all as one hint using ? and |?

@ghost ghost assigned petetronic May 14, 2013
@pthiess
Copy link
Contributor

pthiess commented May 14, 2013

@pfarland - This might be hard to implement in/with Tern, we don't know hence we would make it a Trello item.

@njx
Copy link
Contributor

njx commented May 14, 2013

I wonder if Tern has a notion of disjunctive type--e.g. if it sees that a single variable is used as a number in one place and a string in another, does it just generalize it to Object, or can it hold onto both types as possibilities?

@petetronic
Copy link
Contributor

Tern does seem to track multiple types when looking at assignments and shows proposals from the APIs of those types, however, the built-ins/defs syntax requires an enhancement in Tern to support different signatures. This may need to be extended to consider function API hints from source information too.

@petetronic
Copy link
Contributor

Moved to backlog https://trello.com/c/WwMOtJGp

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants