Skip to content

Conversation

jurgenvinju
Copy link
Member

@jurgenvinju jurgenvinju commented Oct 14, 2025

  1. changes to expressions are very common when rewriting source code
  2. expressions have a regular recursive structure, almost like lists
  3. detecting common sub-expressions between the source and the target tree can be used to infer much smaller TextEdit instances than replacing the entire expression just because it has a different operator at the top.
  4. the default treeDiff rule now replaces the entire expression, while the new code will replace/remove/add only an operator (for example), or only one side of the binary expression. This is logarithmically less damage to the input source code.

Cases currently tackled:

  • removing prefix operator
  • removing postfix operator
  • removing left operand of binary operator
  • removing right operand of binary operator
  • removing brackets
  • adding brackets

This PR will be finished when:

  • a predictable number of cases have been tackled (coverage of typical expression tree modifications)
  • all cases have at least one unit test case

…mically smaller diff patches when expressions have been edited.
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47%. Comparing base (c696a92) to head (45fde50).
⚠️ Report is 60 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##              main   #2484   +/-   ##
=======================================
- Coverage       47%     47%   -1%     
+ Complexity    6622    6618    -4     
=======================================
  Files          783     783           
  Lines        64703   64703           
  Branches      9688    9688           
=======================================
- Hits         30725   30715   -10     
- Misses       31578   31590   +12     
+ Partials      2400    2398    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jurgenvinju jurgenvinju changed the title this adds already a number of special cases that may produce logarithmically smaller diff patches when expressions have been edited. logarithmically smaller diff patches when changing expression trees Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant