forked from VimPlug/jedi
Fix an issue with executed python objects.
This commit is contained in:
@@ -20,8 +20,8 @@ def sorted_definitions(defs):
|
|||||||
return sorted(defs, key=lambda x: (x.module_path or '', x.line or 0, x.column or 0))
|
return sorted(defs, key=lambda x: (x.module_path or '', x.line or 0, x.column or 0))
|
||||||
|
|
||||||
|
|
||||||
def get_on_completion_name(module, lines, position):
|
def get_on_completion_name(module_node, lines, position):
|
||||||
leaf = module.get_leaf_for_position(position)
|
leaf = module_node.get_leaf_for_position(position)
|
||||||
if leaf is None or leaf.type in ('string', 'error_leaf'):
|
if leaf is None or leaf.type in ('string', 'error_leaf'):
|
||||||
# Completions inside strings are a bit special, we need to parse the
|
# Completions inside strings are a bit special, we need to parse the
|
||||||
# string. The same is true for comments and error_leafs.
|
# string. The same is true for comments and error_leafs.
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ def memoize_faked(obj):
|
|||||||
|
|
||||||
@memoize_faked
|
@memoize_faked
|
||||||
def _get_faked(module, obj, name=None):
|
def _get_faked(module, obj, name=None):
|
||||||
obj = type(obj) if is_class_instance(obj) else obj
|
|
||||||
result, fake_module = _faked(module, obj, name)
|
result, fake_module = _faked(module, obj, name)
|
||||||
if result is None:
|
if result is None:
|
||||||
# We're not interested in classes. What we want is functions.
|
# We're not interested in classes. What we want is functions.
|
||||||
|
|||||||
@@ -87,7 +87,11 @@ def setup_readline(namespace_module=__main__):
|
|||||||
|
|
||||||
lines = common.splitlines(text)
|
lines = common.splitlines(text)
|
||||||
position = (len(lines), len(lines[-1]))
|
position = (len(lines), len(lines[-1]))
|
||||||
name = get_on_completion_name(interpreter._get_module(), lines, position)
|
name = get_on_completion_name(
|
||||||
|
interpreter._get_module_node(),
|
||||||
|
lines,
|
||||||
|
position
|
||||||
|
)
|
||||||
before = text[:len(text) - len(name)]
|
before = text[:len(text) - len(name)]
|
||||||
completions = interpreter.completions()
|
completions = interpreter.completions()
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user