forked from VimPlug/jedi
Fix a small extract_variable issue, fixes #1611
This commit is contained in:
@@ -9,7 +9,6 @@ from jedi.common import indent_block
|
|||||||
from jedi.parser_utils import function_is_classmethod, function_is_staticmethod
|
from jedi.parser_utils import function_is_classmethod, function_is_staticmethod
|
||||||
|
|
||||||
|
|
||||||
_EXTRACT_USE_PARENT = EXPRESSION_PARTS + ['trailer']
|
|
||||||
_DEFINITION_SCOPES = ('suite', 'file_input')
|
_DEFINITION_SCOPES = ('suite', 'file_input')
|
||||||
_VARIABLE_EXCTRACTABLE = EXPRESSION_PARTS + \
|
_VARIABLE_EXCTRACTABLE = EXPRESSION_PARTS + \
|
||||||
('atom testlist_star_expr testlist test lambdef lambdef_nocond '
|
('atom testlist_star_expr testlist test lambdef lambdef_nocond '
|
||||||
@@ -57,7 +56,9 @@ def _find_nodes(module_node, pos, until_pos):
|
|||||||
if _is_not_extractable_syntax(start_node):
|
if _is_not_extractable_syntax(start_node):
|
||||||
start_node = start_node.parent
|
start_node = start_node.parent
|
||||||
|
|
||||||
while start_node.parent.type in _EXTRACT_USE_PARENT:
|
if start_node.parent.type == 'trailer':
|
||||||
|
start_node = start_node.parent.parent
|
||||||
|
while start_node.parent.type in EXPRESSION_PARTS:
|
||||||
start_node = start_node.parent
|
start_node = start_node.parent
|
||||||
|
|
||||||
nodes = [start_node]
|
nodes = [start_node]
|
||||||
|
|||||||
2
jedi/third_party/django-stubs
vendored
2
jedi/third_party/django-stubs
vendored
Submodule jedi/third_party/django-stubs updated: 92c8dfc93f...fd057010f6
@@ -17,6 +17,15 @@ def test():
|
|||||||
a = 30 + b
|
a = 30 + b
|
||||||
return test(100, (a, c) + 1)
|
return test(100, (a, c) + 1)
|
||||||
# -------------------------------------------------- simple-3
|
# -------------------------------------------------- simple-3
|
||||||
|
foo = 3.1
|
||||||
|
#? 8 text {'new_name': 'bar'}
|
||||||
|
x = int(foo + 1)
|
||||||
|
# ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
foo = 3.1
|
||||||
|
#? 8 text {'new_name': 'bar'}
|
||||||
|
bar = foo + 1
|
||||||
|
x = int(bar)
|
||||||
|
# -------------------------------------------------- simple-4
|
||||||
#? 13 text {'new_name': 'zzx.x'}
|
#? 13 text {'new_name': 'zzx.x'}
|
||||||
test(100, {1 |1: 2 + 3})
|
test(100, {1 |1: 2 + 3})
|
||||||
# ++++++++++++++++++++++++++++++++++++++++++++++++++
|
# ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|||||||
Reference in New Issue
Block a user