forked from VimPlug/jedi
ignore duplicates of completion outputs, #97
This commit is contained in:
@@ -146,6 +146,7 @@ class Script(object):
|
||||
needs_dot = not dot and path
|
||||
|
||||
comps = []
|
||||
comp_dct = {}
|
||||
for c, s in set(completions):
|
||||
n = c.names[-1]
|
||||
if settings.case_insensitive_completion \
|
||||
@@ -155,7 +156,12 @@ class Script(object):
|
||||
self._parser.user_stmt, n):
|
||||
new = api_classes.Completion(c, needs_dot,
|
||||
len(like), s)
|
||||
comps.append(new)
|
||||
n = new.complete
|
||||
if n in comp_dct and not settings.no_completion_duplicates:
|
||||
comp_dct[n].same_name_completions.append(new)
|
||||
else:
|
||||
comp_dct[n] = new
|
||||
comps.append(new)
|
||||
|
||||
debug.speed('complete end')
|
||||
|
||||
|
||||
@@ -163,6 +163,10 @@ class Completion(BaseDefinition):
|
||||
self.like_name_length = like_name_length
|
||||
self.base = base
|
||||
|
||||
# Completion objects with the same Completion name (which means
|
||||
# duplicate items in the completion)
|
||||
self.same_name_completions = []
|
||||
|
||||
self._followed_definitions = None
|
||||
|
||||
@property
|
||||
|
||||
@@ -14,6 +14,10 @@ add_dot_after_module = False
|
||||
# Removed it again, because in VIM that is not very practical.
|
||||
add_bracket_after_function = False
|
||||
|
||||
# If set, completions with the same name don't appear in the output anymore,
|
||||
# but are in the `same_name_completions` attribute.
|
||||
no_completion_duplicates = False
|
||||
|
||||
# ----------------
|
||||
# parser
|
||||
# ----------------
|
||||
|
||||
Reference in New Issue
Block a user