-
Notifications
You must be signed in to change notification settings - Fork 0
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
[CLOSED] [JS code hints] Argument type guessing is too ambitious sometimes #3354
Comments
Also, as an aside... I'm not sure how to interpret type hints like "String.prototype" or "Event.prototype." Does that mean something different from just "String" or "Event"? |
Reviewing code hinting issues. I think this one is medium priority because it's a case where the information displayed is not correct. |
Reviewed. Assigned |
Oh my. I think what is happening is that tern is parsing the function declarations after 'foo(' as the arguments to 'foo'. The next function is function addQuickOpenPlugin(pluginDef) { ... } Which explains where the fn(pluginDef) hint comes from. And if I move the call to 'foo' around then the hints change based on what function decls come next, probably because they look like function expressions which are being passed to the function. And if you close the parens, 'foo()' then you get the correct hints. Clearly this isn't ideal, though I'm not quite sure how to fix this yet. |
I reassigned this issue to Update: Yes, that fixed the problem. |
Testing this issue in Sprint 32, I discovered that indentation might be playing a role in the problem. When I do not indent the newly inserted test, I get the wrong parameters: When I indent the newly inserted text properly, the parameters are correct: |
|
|
Following the original repro steps, this problem no longer reproduces. It's quite possible (likely?) that this is because the contents of QuickOpen.js have changed, because I think this problem original was the whitespace sensitivity issue as listed above. I'm going to close this now... |
Wednesday Apr 24, 2013 at 00:06 GMT
Originally opened as adobe/brackets#3573
(
Result: hint suggests the arguments are of type "fn:(pluginDef: ?)" and "fn()" respectively.
Expected: if I place the same code at the top or bottom of the module, it says "?" for both types.
It seems to vary a lot by position within the file. If I place the code after _filenameFromPath() I get "fn(query: String.prototype) -> number" and "fn() -> [?]" instead. It seems like the first argument is always inferred to be essentially a function with the same signature as whatever function came right before foo() in the code. I'm not sure why it would make sense to guess that, though.
The text was updated successfully, but these errors were encountered: