diff --git a/jedi/api/file_name.py b/jedi/api/file_name.py index de4e74cc..f7b8df86 100644 --- a/jedi/api/file_name.py +++ b/jedi/api/file_name.py @@ -102,7 +102,7 @@ def _maybe_add_os_path_join(module_context, start_leaf, string): def check_trailer(trailer, arglist_nodes): atom = trailer.get_previous_sibling() - if atom.type != 'trailer': + if atom.type != 'trailer' and trailer.children[0] == '(': return check_for_power(atom, arglist_nodes) return string, False diff --git a/test/test_api/test_completion.py b/test/test_api/test_completion.py index 58ae0f2d..c77ba9a2 100644 --- a/test/test_api/test_completion.py +++ b/test/test_api/test_completion.py @@ -224,6 +224,13 @@ os_path = 'from os.path import *\n' (f2, os_path + 'join(\'tes)', 9, ["t'"]), (f2, os_path + 'join(r"tes"', 10, ['t"']), (f2, os_path + 'join("""tes""")', 11, ['t"""']), + + (f2, os_path + 'join["tes', 9, ['t' + s]), + (f2, os_path + 'join["tes"', 9, ['t' + s]), + (f2, os_path + 'join["tes"]', 9, ['t' + s]), + (f2, os_path + 'join[dirname(__file__), "completi', 33, []), + (f2, os_path + 'join[dirname(__file__), "completi"', 33, []), + (f2, os_path + 'join[dirname(__file__), "completi"]', 33, []), ] ) def test_file_path_completions(Script, file, code, column, expected):