Skip to content

The target node information is not available in update operation #3

Open
@mohayemin

Description

@mohayemin

I have a use case where I need the information of the target nodes in the EditScript. However, only the target node text is passed to the Update objects. For example the code at code_diff/__init__.py:L200 is

if source_ast.type == target_ast.type and len(source_ast.children) == 0 and len(target_ast.children) == 0:
  # Both nodes are tokens of the same type 
  # Only an update is required
  return EditScript([Update(source_ast, target_ast.text)])

I suggest that the last line to be replaced with:

return EditScript([Update(source_ast, target_ast)])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions