1
0
forked from VimPlug/jedi

Fix issues where references were identified as definitions

This commit is contained in:
Dave Halter
2020-03-06 14:23:12 +01:00
parent 6e3bd38600
commit c7a862ec19
3 changed files with 24 additions and 8 deletions

View File

@@ -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):