mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-18 14:29:40 +08:00
refactored Script.complete (no changes to the api)
This commit is contained in:
+6
-9
@@ -135,23 +135,20 @@ class Script(object):
|
|||||||
completions += ((k, bs) for k in keywords.get_keywords(
|
completions += ((k, bs) for k in keywords.get_keywords(
|
||||||
all=True))
|
all=True))
|
||||||
|
|
||||||
|
needs_dot = not dot and path
|
||||||
|
|
||||||
comps = []
|
comps = []
|
||||||
for c, s in completions:
|
for c, s in set(completions):
|
||||||
n = c.names[-1]
|
n = c.names[-1]
|
||||||
if settings.case_insensitive_completion \
|
if settings.case_insensitive_completion \
|
||||||
and n.lower().startswith(like.lower()) \
|
and n.lower().startswith(like.lower()) \
|
||||||
or n.startswith(like):
|
or n.startswith(like):
|
||||||
if not evaluate.filter_private_variable(s,
|
if not evaluate.filter_private_variable(s,
|
||||||
self.parser.user_stmt, n):
|
self.parser.user_stmt, n):
|
||||||
comps.append((c, s))
|
new = api_classes.Completion( c, needs_dot, len(like), s)
|
||||||
|
comps.append(new)
|
||||||
|
|
||||||
needs_dot = not dot and path
|
return sorted(comps, key=lambda x: (x.word.startswith('__'),
|
||||||
completions = set(comps)
|
|
||||||
|
|
||||||
c = [api_classes.Completion(
|
|
||||||
c, needs_dot, len(like), s) for c, s in completions]
|
|
||||||
|
|
||||||
return sorted(c, key=lambda x: (x.word.startswith('__'),
|
|
||||||
x.word.lower()))
|
x.word.lower()))
|
||||||
|
|
||||||
def _prepare_goto(self, goto_path, is_like_search=False):
|
def _prepare_goto(self, goto_path, is_like_search=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user