mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Fix another comment extraction issue
This commit is contained in:
@@ -114,7 +114,11 @@ def _replace(nodes, expression_replacement, extracted, pos,
|
||||
if first_node_leaf is insert_before_leaf:
|
||||
replacement_dct[nodes[0]] = extracted_prefix + expression_replacement
|
||||
else:
|
||||
replacement_dct[nodes[0]] = first_node_leaf.prefix + expression_replacement
|
||||
if remaining_prefix is None:
|
||||
p = first_node_leaf.prefix
|
||||
else:
|
||||
p = remaining_prefix + _get_indentation(nodes[0])
|
||||
replacement_dct[nodes[0]] = p + expression_replacement
|
||||
replacement_dct[insert_before_leaf] = extracted_prefix + insert_before_leaf.value
|
||||
|
||||
for node in nodes[1:]:
|
||||
|
||||
@@ -242,3 +242,36 @@ def x(v1):
|
||||
x, y = a(v1, v2, v3)
|
||||
#bar
|
||||
return x, y
|
||||
# -------------------------------------------------- with-range-func-2
|
||||
import os
|
||||
# comment1
|
||||
@dec
|
||||
# comment2
|
||||
def x(v1):
|
||||
#? 2 text {'new_name': 'a', 'until_line': 11, 'until_column': 0}
|
||||
#foo
|
||||
v2 = 2
|
||||
if 1:
|
||||
x, y = os.listdir(v1 + v2 * v3)
|
||||
#bar
|
||||
return y
|
||||
x
|
||||
# ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
import os
|
||||
# comment1
|
||||
def a(v1, v2, v3):
|
||||
#foo
|
||||
v2 = 2
|
||||
if 1:
|
||||
x, y = os.listdir(v1 + v2 * v3)
|
||||
#bar
|
||||
return y
|
||||
|
||||
|
||||
@dec
|
||||
# comment2
|
||||
def x(v1):
|
||||
#? 2 text {'new_name': 'a', 'until_line': 11, 'until_column': 0}
|
||||
y = a(v1, v2, v3)
|
||||
return y
|
||||
x
|
||||
|
||||
Reference in New Issue
Block a user