1
0
forked from VimPlug/jedi

Make nested dict completions possible.

See also https://github.com/ipython/ipython/issues/13866
This commit is contained in:
Dave Halter
2023-07-28 23:50:38 +02:00
parent d8420d0f72
commit 62cbcb0844
2 changed files with 13 additions and 2 deletions

View File

@@ -36,8 +36,11 @@ def complete_dict(module_context, code_lines, leaf, position, string, fuzzy):
string = cut_value_at_position(leaf, position)
context = module_context.create_context(bracket_leaf)
before_bracket_leaf = bracket_leaf.get_previous_leaf()
if before_bracket_leaf.type in ('atom', 'trailer', 'name'):
before_node = before_bracket_leaf = bracket_leaf.get_previous_leaf()
if before_node in (')', ']', '}'):
before_node = before_node.parent
if before_node.type in ('atom', 'trailer', 'name'):
values = infer_call_of_leaf(context, before_bracket_leaf)
return list(_completions_for_dicts(
module_context.inference_state,