Finding the autocompletion stack is a bit more complicated than I initially thought

Fixes #968.
This commit is contained in:
Dave Halter
2018-01-31 08:45:01 +01:00
parent 522e7123ed
commit ebe8123b4c
2 changed files with 5 additions and 1 deletions

View File

@@ -134,7 +134,7 @@ def get_stack_at_position(grammar, code_lines, module_node, pos):
# completion.
# Use Z as a prefix because it's not part of a number suffix.
safeword = 'ZZZ_USER_WANTS_TO_COMPLETE_HERE_WITH_JEDI'
code = code + safeword
code = code + ' ' + safeword
p = Parser(grammar._pgen_grammar, error_recovery=True)
try:

View File

@@ -18,6 +18,10 @@ int(str)
str..
#? []
a(0):.
#? 2 ['and', 'or', 'if', 'is', 'in', 'not']
0x0
#? ['and', 'or', 'if', 'is', 'in', 'not']
1j
# -----------------
# if/else/elif