[RESOLVED] Function parameter autocomplete


Sorry if this already exists but my search weren’t successful.

I’m trying to extract js variables defined in a codeMirror instance, using token.state and it works quite well, except for one case that can be seen in the autocomplete demo:

Basically if the autocomplete is triggered inside a function, with a string that matches one of the parameter name, the parameter isn’t in the token state.

function sum(first, second){

Here | indicates cursor position when triggering the autocomplete.
What’s funny is that if you trigger the autocomplete with this

function sum(first, second){

you’ll get the function params.

Is this a known limitation?

That was a bug in javascript-hint, I’m not sure if it had been broken from the start or something changed at some point, but it only iterated over the current local variables, not the locals in outer scopes. This patch should help.

I didn’t think of looking into context, and it works well for my case, thanks a lot!