mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 07:14:48 +08:00
Fix a function extract indentation issue
This commit is contained in:
@@ -266,7 +266,7 @@ def extract_function(inference_state, path, module_context, name, pos, until_pos
|
|||||||
if is_expression:
|
if is_expression:
|
||||||
replacement = function_call
|
replacement = function_call
|
||||||
else:
|
else:
|
||||||
replacement = _get_indentation(nodes[0]) + output_var_str + ' = ' + function_call + '\n'
|
replacement = output_var_str + ' = ' + function_call + '\n'
|
||||||
|
|
||||||
replacement_dct = _replace(nodes, replacement, function_code, pos,
|
replacement_dct = _replace(nodes, replacement, function_code, pos,
|
||||||
insert_before_leaf, remaining_prefix)
|
insert_before_leaf, remaining_prefix)
|
||||||
|
|||||||
@@ -211,3 +211,34 @@ def a(test, v3):
|
|||||||
y = a(test, v3)
|
y = a(test, v3)
|
||||||
#raaaa
|
#raaaa
|
||||||
y
|
y
|
||||||
|
# -------------------------------------------------- with-range-func-1
|
||||||
|
import os
|
||||||
|
# comment1
|
||||||
|
@dec
|
||||||
|
# comment2
|
||||||
|
def x(v1):
|
||||||
|
#foo
|
||||||
|
#? 2 text {'new_name': 'a', 'until_line': 9, 'until_column': 5}
|
||||||
|
v2 = 2
|
||||||
|
if 1:
|
||||||
|
x, y = os.listdir(v1 + v2 * v3)
|
||||||
|
#bar
|
||||||
|
return x, y
|
||||||
|
# ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
import os
|
||||||
|
# comment1
|
||||||
|
def a(v1, v2, v3):
|
||||||
|
v2 = 2
|
||||||
|
if 1:
|
||||||
|
x, y = os.listdir(v1 + v2 * v3)
|
||||||
|
return x, y
|
||||||
|
|
||||||
|
|
||||||
|
@dec
|
||||||
|
# comment2
|
||||||
|
def x(v1):
|
||||||
|
#foo
|
||||||
|
#? 2 text {'new_name': 'a', 'until_line': 9, 'until_column': 5}
|
||||||
|
x, y = a(v1, v2, v3)
|
||||||
|
#bar
|
||||||
|
return x, y
|
||||||
|
|||||||
Reference in New Issue
Block a user