diff --git a/jedi/api/helpers.py b/jedi/api/helpers.py index 24b0db6a..07dcab8a 100644 --- a/jedi/api/helpers.py +++ b/jedi/api/helpers.py @@ -466,4 +466,6 @@ def validate_line_column(func): def split_search_string(name): type, _, dotted_names = name.rpartition(' ') + if type == 'def': + type = 'function' return type, dotted_names.split('.') diff --git a/test/test_api/test_project.py b/test/test_api/test_project.py index 0885c3e5..d9ea05fa 100644 --- a/test/test_api/test_project.py +++ b/test/test_api/test_project.py @@ -61,6 +61,10 @@ def test_load_save_project(tmpdir): ('sample_int', ['helpers.sample_int'], {}), ('sample_int', ['helpers.sample_int'], dict(all_scopes=True)), ('sample_int.real', ['builtins.int.real'], {}), + + ('class sample_int.real', [], {}), + ('function sample_int.real', ['builtins.int.real'], {}), + ('def sample_int.real', ['builtins.int.real'], {}), ] ) @pytest.mark.skipif(sys.version_info < (3, 6), reason="Ignore Python 2, because EOL")