forked from VimPlug/jedi
REPL completion deletes the line sometimes, fixes #293
This commit is contained in:
@@ -70,6 +70,7 @@ def setup_readline(namespace_module=__main__):
|
|||||||
# use the "default" completion with ``getattr`` if
|
# use the "default" completion with ``getattr`` if
|
||||||
# possible.
|
# possible.
|
||||||
path, dot, like = interpreter._get_completion_parts()
|
path, dot, like = interpreter._get_completion_parts()
|
||||||
|
before = text[:len(text) - len(like)]
|
||||||
# Shouldn't be an import statement and just a simple path
|
# Shouldn't be an import statement and just a simple path
|
||||||
# with dots.
|
# with dots.
|
||||||
is_import = re.match('^\s*(import|from) ', text)
|
is_import = re.match('^\s*(import|from) ', text)
|
||||||
@@ -88,11 +89,10 @@ def setup_readline(namespace_module=__main__):
|
|||||||
for n in namespaces:
|
for n in namespaces:
|
||||||
for name in dir(n):
|
for name in dir(n):
|
||||||
if name.lower().startswith(like.lower()):
|
if name.lower().startswith(like.lower()):
|
||||||
self.matches.append(path + dot + name)
|
self.matches.append(before + name)
|
||||||
else:
|
else:
|
||||||
completions = interpreter.completions()
|
completions = interpreter.completions()
|
||||||
|
|
||||||
before = text[:len(text) - len(like)]
|
|
||||||
self.matches = [before + c.name_with_symbols
|
self.matches = [before + c.name_with_symbols
|
||||||
for c in completions]
|
for c in completions]
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
""" named params:
|
""" named params:
|
||||||
>>> def a(abc): pass
|
>>> def a(abc): pass
|
||||||
|
...
|
||||||
>>> a(abc=3) # <- this stuff
|
>>> a(abc=3) # <- this stuff
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user