forked from VimPlug/jedi
Fix issues where references were identified as definitions
This commit is contained in:
@@ -122,11 +122,15 @@ def get_names_of_node(node):
|
||||
return list(chain.from_iterable(get_names_of_node(c) for c in children))
|
||||
|
||||
|
||||
def get_module_names(module, all_scopes):
|
||||
def get_module_names(module, all_scopes, definitions=True, references=False):
|
||||
"""
|
||||
Returns a dictionary with name parts as keys and their call paths as
|
||||
values.
|
||||
"""
|
||||
def def_ref_filter(name):
|
||||
is_def = name.is_definition()
|
||||
return definitions and is_def or references and not is_def
|
||||
|
||||
names = list(chain.from_iterable(module.get_used_names().values()))
|
||||
if not all_scopes:
|
||||
# We have to filter all the names that don't have the module as a
|
||||
@@ -142,7 +146,7 @@ def get_module_names(module, all_scopes):
|
||||
return parent_scope in (module, None)
|
||||
|
||||
names = [n for n in names if is_module_scope_name(n)]
|
||||
return names
|
||||
return filter(def_ref_filter, names)
|
||||
|
||||
|
||||
def is_string(value):
|
||||
|
||||
Reference in New Issue
Block a user