forked from VimPlug/jedi
Remove needs_dot and settings.add_dot_after_module. Both are not really used anymore with context completions anymore.
Also the setting doesn't seem to be used anywhere as far as I can tell.
This commit is contained in:
@@ -365,10 +365,9 @@ class Completion(BaseDefinition):
|
|||||||
`Completion` objects are returned from :meth:`api.Script.completions`. They
|
`Completion` objects are returned from :meth:`api.Script.completions`. They
|
||||||
provide additional information about a completion.
|
provide additional information about a completion.
|
||||||
"""
|
"""
|
||||||
def __init__(self, evaluator, name, needs_dot, like_name_length):
|
def __init__(self, evaluator, name, like_name_length):
|
||||||
super(Completion, self).__init__(evaluator, name)
|
super(Completion, self).__init__(evaluator, name)
|
||||||
|
|
||||||
self._needs_dot = needs_dot
|
|
||||||
self._like_name_length = like_name_length
|
self._like_name_length = like_name_length
|
||||||
|
|
||||||
# Completion objects with the same Completion name (which means
|
# Completion objects with the same Completion name (which means
|
||||||
@@ -376,22 +375,18 @@ class Completion(BaseDefinition):
|
|||||||
self._same_name_completions = []
|
self._same_name_completions = []
|
||||||
|
|
||||||
def _complete(self, like_name):
|
def _complete(self, like_name):
|
||||||
dot = '.' if self._needs_dot else ''
|
|
||||||
append = ''
|
append = ''
|
||||||
if settings.add_bracket_after_function \
|
if settings.add_bracket_after_function \
|
||||||
and self.type == 'Function':
|
and self.type == 'Function':
|
||||||
append = '('
|
append = '('
|
||||||
|
|
||||||
if settings.add_dot_after_module:
|
|
||||||
if isinstance(self._definition, tree.Module):
|
|
||||||
append += '.'
|
|
||||||
if isinstance(self._definition, tree.Param):
|
if isinstance(self._definition, tree.Param):
|
||||||
append += '='
|
append += '='
|
||||||
|
|
||||||
name = str(self._name)
|
name = str(self._name)
|
||||||
if like_name:
|
if like_name:
|
||||||
name = name[self._like_name_length:]
|
name = name[self._like_name_length:]
|
||||||
return dot + name + append
|
return name + append
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def complete(self):
|
def complete(self):
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ def get_call_signature_param_names(call_signatures):
|
|||||||
yield p._name
|
yield p._name
|
||||||
|
|
||||||
|
|
||||||
def filter_names(evaluator, completion_names, needs_dot, like_name):
|
def filter_names(evaluator, completion_names, like_name):
|
||||||
comp_dct = {}
|
comp_dct = {}
|
||||||
for name in set(completion_names):
|
for name in set(completion_names):
|
||||||
if settings.case_insensitive_completion \
|
if settings.case_insensitive_completion \
|
||||||
@@ -43,7 +43,6 @@ def filter_names(evaluator, completion_names, needs_dot, like_name):
|
|||||||
new = classes.Completion(
|
new = classes.Completion(
|
||||||
evaluator,
|
evaluator,
|
||||||
name,
|
name,
|
||||||
needs_dot,
|
|
||||||
len(like_name)
|
len(like_name)
|
||||||
)
|
)
|
||||||
k = (new.name, new.complete) # key
|
k = (new.name, new.complete) # key
|
||||||
@@ -74,10 +73,8 @@ class Completion:
|
|||||||
call_signatures = self._call_signatures_method()
|
call_signatures = self._call_signatures_method()
|
||||||
completion_names += get_call_signature_param_names(call_signatures)
|
completion_names += get_call_signature_param_names(call_signatures)
|
||||||
|
|
||||||
needs_dot = not completion_parts.has_dot and completion_parts.path
|
|
||||||
|
|
||||||
completions = filter_names(self._evaluator, completion_names,
|
completions = filter_names(self._evaluator, completion_names,
|
||||||
needs_dot, completion_parts.name)
|
completion_parts.name)
|
||||||
|
|
||||||
return sorted(completions, key=lambda x: (x.name.startswith('__'),
|
return sorted(completions, key=lambda x: (x.name.startswith('__'),
|
||||||
x.name.startswith('_'),
|
x.name.startswith('_'),
|
||||||
|
|||||||
@@ -86,13 +86,6 @@ case_insensitive_completion = True
|
|||||||
The completion is by default case insensitive.
|
The completion is by default case insensitive.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
add_dot_after_module = False
|
|
||||||
"""
|
|
||||||
Adds a dot after a module, because a module that is not accessed this way is
|
|
||||||
definitely not the normal case. However, in VIM this doesn't work, that's why
|
|
||||||
it isn't used at the moment.
|
|
||||||
"""
|
|
||||||
|
|
||||||
add_bracket_after_function = False
|
add_bracket_after_function = False
|
||||||
"""
|
"""
|
||||||
Adds an opening bracket after a function, because that's normal behaviour.
|
Adds an opening bracket after a function, because that's normal behaviour.
|
||||||
|
|||||||
Reference in New Issue
Block a user