forked from VimPlug/jedi
Small bug fixes.
This commit is contained in:
@@ -185,7 +185,7 @@ class DiffParser(object):
|
|||||||
|
|
||||||
print('test', last_line, until_line_old, node)
|
print('test', last_line, until_line_old, node)
|
||||||
if last_line > until_line_old:
|
if last_line > until_line_old:
|
||||||
divided_node = self._divide_node(node, until_line_new)
|
divided_node = self._divide_node(node, until_line_old)
|
||||||
print('divided', divided_node)
|
print('divided', divided_node)
|
||||||
if divided_node is not None:
|
if divided_node is not None:
|
||||||
nodes.append(divided_node)
|
nodes.append(divided_node)
|
||||||
@@ -199,7 +199,7 @@ class DiffParser(object):
|
|||||||
nodes.pop()
|
nodes.pop()
|
||||||
|
|
||||||
if nodes:
|
if nodes:
|
||||||
print('COPY', until_line_new)
|
print('COPY', until_line_new, nodes)
|
||||||
self._copy_count += 1
|
self._copy_count += 1
|
||||||
parent = self._insert_nodes(nodes)
|
parent = self._insert_nodes(nodes)
|
||||||
self._update_names_dict(parent, nodes)
|
self._update_names_dict(parent, nodes)
|
||||||
@@ -211,6 +211,21 @@ class DiffParser(object):
|
|||||||
# that is not finished.
|
# that is not finished.
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def _get_old_line_stmt(self, old_line):
|
||||||
|
leaf = self._old_module.get_leaf_for_position((old_line, 0), include_prefixes=True)
|
||||||
|
|
||||||
|
if leaf.type == 'newline':
|
||||||
|
leaf = leaf.get_next_leaf()
|
||||||
|
if leaf.get_start_pos_of_prefix()[0] == old_line:
|
||||||
|
node = leaf
|
||||||
|
# TODO use leaf.get_definition one day when that one is working
|
||||||
|
# well.
|
||||||
|
while node.parent.type not in ('file_input', 'suite'):
|
||||||
|
node = node.parent
|
||||||
|
return node
|
||||||
|
# Must be on the same line. Otherwise we need to parse that bit.
|
||||||
|
return None
|
||||||
|
|
||||||
def _update_positions(self, nodes, line_offset):
|
def _update_positions(self, nodes, line_offset):
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
try:
|
try:
|
||||||
@@ -365,7 +380,7 @@ class DiffParser(object):
|
|||||||
child.parent = new_node
|
child.parent = new_node
|
||||||
for i, child in enumerate(new_suite.children):
|
for i, child in enumerate(new_suite.children):
|
||||||
child.parent = new_suite
|
child.parent = new_suite
|
||||||
if child.end_pos[1] > until_line:
|
if child.end_pos[0] > until_line:
|
||||||
divided_node = self._divide_node(child, until_line)
|
divided_node = self._divide_node(child, until_line)
|
||||||
new_suite.children = new_suite.children[:i]
|
new_suite.children = new_suite.children[:i]
|
||||||
if divided_node is not None:
|
if divided_node is not None:
|
||||||
@@ -377,20 +392,6 @@ class DiffParser(object):
|
|||||||
break
|
break
|
||||||
return new_node
|
return new_node
|
||||||
|
|
||||||
def _get_old_line_stmt(self, old_line):
|
|
||||||
leaf = self._old_module.get_leaf_for_position((old_line, 0), include_prefixes=True)
|
|
||||||
if leaf.type == 'newline':
|
|
||||||
leaf = leaf.get_next_leaf()
|
|
||||||
if leaf.get_start_pos_of_prefix()[0] == old_line:
|
|
||||||
node = leaf
|
|
||||||
# TODO use leaf.get_definition one day when that one is working
|
|
||||||
# well.
|
|
||||||
while node.parent.type not in ('file_input', 'suite'):
|
|
||||||
node = node.parent
|
|
||||||
return node
|
|
||||||
# Must be on the same line. Otherwise we need to parse that bit.
|
|
||||||
return None
|
|
||||||
|
|
||||||
def _parse(self, until_line):
|
def _parse(self, until_line):
|
||||||
"""
|
"""
|
||||||
Parses at least until the given line, but might just parse more until a
|
Parses at least until the given line, but might just parse more until a
|
||||||
|
|||||||
Reference in New Issue
Block a user