mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Start working on param autocompletion for the REPL.
This commit is contained in:
@@ -118,11 +118,11 @@ def find_syntax_node_name(evaluator, python_object):
|
||||
# be something like ``email.utils``).
|
||||
return module
|
||||
|
||||
try:
|
||||
names = module.used_names[python_object.__name__]
|
||||
except NameError:
|
||||
return None
|
||||
name_str = python_object.__name__
|
||||
if name_str == '<lambda>':
|
||||
return None # It's too hard to find lambdas.
|
||||
|
||||
names = module.used_names[name_str]
|
||||
names = [n for n in names if n.is_definition()]
|
||||
|
||||
try:
|
||||
|
||||
@@ -148,3 +148,12 @@ class TestInterpreterAPI(TestCase):
|
||||
foo = Foo()
|
||||
self.check_interpreter_complete('foo.bar', locals(), ['bar'])
|
||||
self.check_interpreter_complete('foo.bar.baz', locals(), [])
|
||||
|
||||
def test_param_completion(self):
|
||||
def foo(bar):
|
||||
pass
|
||||
|
||||
lambd = lambda x: 3
|
||||
|
||||
self.check_interpreter_complete('foo(bar', locals(), ['bar'])
|
||||
self.check_interpreter_complete('lambd(x', locals(), ['x'])
|
||||
|
||||
Reference in New Issue
Block a user