From dffce937f289b2ff0bf6cce4e6ef90bd31a58937 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 8 Dec 2014 00:52:40 +0100 Subject: [PATCH] With the old parser we did more complicated checking for invalid statements, now the new parser does it by itself. Therefore we can stop doing crazy regex stuff in the API. --- jedi/api/__init__.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index a84fb2bb..246af06f 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -155,23 +155,12 @@ class Script(object): return self._simple_complete(path, dot, like) - def completion_possible(path): - """ - The completion logic is kind of complicated, because we strip the - last word part. To ignore certain strange patterns with dots, just - use regex. - """ - - if re.match('\d+\.\.$|\.{4}$', path): - return True # check Ellipsis and float literal `1.` - - return not re.search(r'^\.|^\d\.$|\.\.$', path) - debug.speed('completions start') path = self._user_context.get_path_until_cursor() - # TODO still needed with the new parser? - #if not completion_possible(path): - # return [] + # dots following an int are not the start of a completion but a float + # literal. + if re.search(r'^\d\.$', path): + return [] path, dot, like = helpers.completion_parts(path) user_stmt = self._parser.user_stmt_with_whitespace()