Skip to content

Commit 3f901c5

Browse files
committed
[javascript-hint addon] Properly iterate over local scopes
See https://discuss.codemirror.net/t/function-parameter-autocomplete/2240/1
1 parent ddafba7 commit 3f901c5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

addon/hint/javascript-hint.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@
147147
// If not, just look in the global object and any local scope
148148
// (reading into JS mode internals to get at the local and global variables)
149149
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
150+
for (var c = token.state.context; c; c = c.prev)
151+
for (var v = c.vars; v; v = v.next) maybeAdd(v.name)
150152
for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
151153
if (!options || options.useGlobalScope !== false)
152154
gatherCompletions(global);

0 commit comments

Comments
 (0)