1
0
forked from VimPlug/jedi

Completion: Don't suggest variables when only kwargs are legal, fixes #1541

This commit is contained in:
Dave Halter
2020-04-17 22:58:55 +02:00
parent f871f5e726
commit f07dee3564
3 changed files with 127 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ from jedi.inference.base_value import NO_VALUES
from jedi.inference.syntax_tree import infer_atom
from jedi.inference.helpers import infer_call_of_leaf
from jedi.inference.compiled import get_string_value_set
from jedi.cache import signature_time_cache
from jedi.cache import signature_time_cache, memoize_method
from jedi.parser_utils import get_parent_scope
@@ -216,11 +216,15 @@ class CallDetails(object):
def keyword_name_str(self):
return _get_index_and_key(self._children, self._position)[1]
@memoize_method
def _list_arguments(self):
return list(_iter_arguments(self._children, self._position))
def calculate_index(self, param_names):
positional_count = 0
used_names = set()
star_count = -1
args = list(_iter_arguments(self._children, self._position))
args = self._list_arguments()
if not args:
if param_names:
return 0
@@ -267,6 +271,19 @@ class CallDetails(object):
return i
return None
def iter_used_keyword_arguments(self):
for star_count, key_start, had_equal in list(self._list_arguments()):
if had_equal and key_start:
yield key_start
def count_positional_arguments(self):
count = 0
for star_count, key_start, had_equal in self._list_arguments()[:-1]:
if star_count:
break
count += 1
return count
def _iter_arguments(nodes, position):
def remove_after_pos(name):