diff --git a/functions.py b/functions.py index d2aa0bdf..172baf23 100644 --- a/functions.py +++ b/functions.py @@ -182,7 +182,8 @@ def complete(source, line, column, source_path): try: scopes = _prepare_goto(source, pos, source_path, f, path, True) except NotFoundError: - scope_generator = evaluate.get_names_for_scope(f.parser.user_scope) + scope_generator = evaluate.get_names_for_scope(f.parser.user_scope, + pos) completions = [] for dummy, name_list in scope_generator: completions += name_list diff --git a/test/completion/ordering.py b/test/completion/ordering.py index 52c74281..05d3a342 100644 --- a/test/completion/ordering.py +++ b/test/completion/ordering.py @@ -15,6 +15,10 @@ b = 1; b = "" #? str() b +# temp should not be accessible before definition +#? [] +temp + a = 1 temp = b; b = a diff --git a/test/run.py b/test/run.py index d0a2564a..84c2b0ab 100755 --- a/test/run.py +++ b/test/run.py @@ -32,7 +32,7 @@ def run_completion_test(correct, source, line_nr, line, path): return 1 else: # TODO remove set! duplicates should not be normal - comp_str = str(sorted(set([str(c) for c in completions]))) + comp_str = str(sorted(set([c.word for c in completions]))) if comp_str != correct: print('Solution @%s not right, received %s, wanted %s'\ % (line_nr - 1, comp_str, correct))