jackfirth / resyntax

A Racket refactoring engine
Apache License 2.0
51 stars 10 forks source link

Avoid quadratic interaction #224

Closed sorawee closed 7 months ago

sorawee commented 8 months ago

After opening a PR, Resyntax could make $n$ suggestions. Accepting the first suggestion re-runs Resyntax, generating $n-1$ suggestion. Accepting the second suggestion re-runs Resyntax, generating $n-2$ suggestion. And so on. Eventually, there are $O(n^2)$ comments in the GitHub PR, and most of them are identical to previously issued suggestions.

I understand the need to re-run Resyntax at every commit, because there could be more suggestions made available after accepting a suggestion. Still, the $O(n^2)$ problem is real and obviously undesirable.

A couple of possibilities to help with this problem:

jackfirth commented 7 months ago

I think there's a way to group multiple suggestions into a single commit. Does this problem only occur if you keep the suggestions as separate commits?

sorawee commented 7 months ago

Does this problem only occur if you keep the suggestions as separate commits?

I'm not sure what you mean by this.

jackfirth commented 7 months ago

When opening a PR, resyntax makes N suggestions. GitHub offers a way to batch all suggested changes in a review together into a single commit. If you do that, Resyntax won't display the quadratic behavior, correct?

sorawee commented 7 months ago

GitHub offers a way to batch all suggested changes in a review together into a single commit.

I have no idea that this is a thing, and I still don't know how to use it.

jackfirth commented 7 months ago

It's the "Add suggestion to batch" button.

Screenshot 2024-01-08 at 9 15 48 AM

You have to go to the Files tab though, that's why it's greyed out here.

sorawee commented 7 months ago

Ah, I see! Looks like this will solve my problem, then!