forked from VimPlug/jedi
Comprehensions are also possible arguments. Fixes 1146
This commit is contained in:
@@ -166,7 +166,8 @@ def _get_index_and_key(nodes, position):
|
|||||||
|
|
||||||
if nodes_before:
|
if nodes_before:
|
||||||
last = nodes_before[-1]
|
last = nodes_before[-1]
|
||||||
if last.type == 'argument' and last.children[1].end_pos <= position:
|
if last.type == 'argument' and last.children[1] == '=' \
|
||||||
|
and last.children[1].end_pos <= position:
|
||||||
# Checked if the argument
|
# Checked if the argument
|
||||||
key_str = last.children[0].value
|
key_str = last.children[0].value
|
||||||
elif last == '=':
|
elif last == '=':
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ left
|
|||||||
[a for a in {1:'x'}][0]
|
[a for a in {1:'x'}][0]
|
||||||
|
|
||||||
# list comprehensions should also work in combination with functions
|
# list comprehensions should also work in combination with functions
|
||||||
def listen(arg):
|
def _listen(arg):
|
||||||
for x in arg:
|
for x in arg:
|
||||||
#? str()
|
#? str()
|
||||||
x
|
x
|
||||||
|
|
||||||
listen(['' for x in [1]])
|
_listen(['' for x in [1]])
|
||||||
#?
|
#?
|
||||||
([str for x in []])[0]
|
([str for x in []])[0]
|
||||||
|
|
||||||
@@ -212,3 +212,14 @@ next(iter({a for a in range(10)}))
|
|||||||
|
|
||||||
#? int()
|
#? int()
|
||||||
[a for a in {1, 2, 3}][0]
|
[a for a in {1, 2, 3}][0]
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# syntax errors
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# Issue #1146
|
||||||
|
|
||||||
|
#? ['list']
|
||||||
|
[int(str(x.value) for x in list
|
||||||
|
|
||||||
|
def reset_missing_bracket(): pass
|
||||||
|
|||||||
Reference in New Issue
Block a user