1
0
forked from VimPlug/jedi

Merge branch 'master' into typeshed

This commit is contained in:
Dave Halter
2018-10-02 19:07:59 +02:00
13 changed files with 78 additions and 16 deletions
+7 -4
View File
@@ -105,14 +105,17 @@ def get_stack_at_position(grammar, code_lines, module_node, pos):
# TODO This is for now not an official parso API that exists purely
# for Jedi.
tokens = grammar._tokenize(code)
for token_ in tokens:
if token_.string == safeword:
for token in tokens:
if token.string == safeword:
raise EndMarkerReached()
elif token_.prefix.endswith(safeword):
elif token.prefix.endswith(safeword):
# This happens with comments.
raise EndMarkerReached()
elif token.string.endswith(safeword):
yield token # Probably an f-string literal that was not finished.
raise EndMarkerReached()
else:
yield token_
yield token
# The code might be indedented, just remove it.
code = dedent(_get_code_for_stack(code_lines, module_node, pos))