-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function parameter types should default to what is doc'd if a type cannot be computed #392
Comments
Is it possible that Tern can not find a type called |
Yes, that type would not be available in the demo, but I assumed that since the demo was using the doc plugin it would be able to infer the type as orion.Editor. Or does tern ignore what is specified in doc if it cannot find the type while inferring? |
Tern currently doesn't have a mechanism for storing types that it only knows the string name of -- it works with type objects that it either got from loading a .json definition file or from analyzing the code itself. You could write a simple .json file that defines |
Alternatively, the third-party tern-closure plugin creates stand-in types for types in docs that it cannot locate (meaning that an |
@jgiles That sounds good. How did you solve the problem of the made-up type introducing ambiguity later on? |
@marijnh At present, stand-in types are just propagated with a low weight, and when the actual value is declared and assigned later it displaces the stand-in. |
Attached patch adds something like this to the |
Use the following snippet in the Tern demo:
/**
*/
function f(one, two, three) {
loop: do{
t//ASSIST HERE
//empty
continue loop;
} while(true)
}
Activate assist where indicated and notice the type for 'two' is computed to be '?' I would expect it to be 'orion.Editor' since thats what I said it is.
The text was updated successfully, but these errors were encountered: