1
0
forked from VimPlug/jedi

Avoid wrong random call signature completion, fixes #1433

This commit is contained in:
Dave Halter
2019-12-03 22:12:33 +01:00
parent fea80c7fc8
commit f46f00bc71
3 changed files with 30 additions and 2 deletions

View File

@@ -210,7 +210,15 @@ class Completion:
completion_names += self._global_completions()
completion_names += self._get_class_value_completions(is_function=False)
if 'trailer' in nonterminals:
# Apparently this looks like it's good enough to filter most cases
# so that signature completions don't randomly appear.
# To understand why this works, two things are important:
# 1. trailer with a `,` in it is either a subscript or an arglist.
# 2. If there's no `,`, it's at the start and only signatures start
# with `(`. Other trailers could start with `.` or `[`.
# One thing that might not work is completion in decorator
# executions, but most people won't care about that.
if nodes[-1] in ['(', ','] and nonterminals[-1] in ('trailer', 'arglist'):
call_signatures = self._call_signatures_callback()
completion_names += get_call_signature_param_names(call_signatures)