From 4b0465a2d1e2782f605c806a01f6d68581359fa0 Mon Sep 17 00:00:00 2001 From: David Halter Date: Fri, 16 Aug 2013 10:00:52 +0430 Subject: [PATCH] REPL completion deletes the line sometimes, fixes #293 --- jedi/utils.py | 4 ++-- test/completion/named_param.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jedi/utils.py b/jedi/utils.py index dba4a4e5..4c8b7c8b 100644 --- a/jedi/utils.py +++ b/jedi/utils.py @@ -70,6 +70,7 @@ def setup_readline(namespace_module=__main__): # use the "default" completion with ``getattr`` if # possible. path, dot, like = interpreter._get_completion_parts() + before = text[:len(text) - len(like)] # Shouldn't be an import statement and just a simple path # with dots. is_import = re.match('^\s*(import|from) ', text) @@ -88,11 +89,10 @@ def setup_readline(namespace_module=__main__): for n in namespaces: for name in dir(n): if name.lower().startswith(like.lower()): - self.matches.append(path + dot + name) + self.matches.append(before + name) else: completions = interpreter.completions() - before = text[:len(text) - len(like)] self.matches = [before + c.name_with_symbols for c in completions] try: diff --git a/test/completion/named_param.py b/test/completion/named_param.py index 949fe53a..8081bee2 100644 --- a/test/completion/named_param.py +++ b/test/completion/named_param.py @@ -1,5 +1,6 @@ """ named params: >>> def a(abc): pass +... >>> a(abc=3) # <- this stuff """