jwoudenberg / elm-pair

An artificial pair-programmer that helps you write Elm

Home Page:https://elm-pair.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Renaming seems sensitive to typing speed

Janiczek opened this issue · comments

Sometimes the renaming refactor stops in the middle in diffs like:

 setCohortsSorting : UX.SortableTable.Sorting -> BookModel a -> BookModel a
-setCohortsSorting groupsSorting bookModel =
+setCohortsSorting Sorting bookModel =
     update (\model -> { model | groupsSorting = groupsSorting }) bookModel

followed by

 setCohortsSorting : UX.SortableTable.Sorting -> BookModel a -> BookModel a
-setCohortsSorting Sorting bookModel =
+setCohortsSorting coSorting bookModel =
     update (\model -> { model | groupsSorting = Sorting }) bookModel

resulting in

setCohortsSorting : UX.SortableTable.Sorting -> BookModel a -> BookModel a
setCohortsSorting coSorting bookModel =
    update (\model -> { model | groupsSorting = cSorting }) bookModel

(note the cSorting in expr compared to the coSorting in the fn argument)

while if I write slowly letter by letter ( -> c -> co etc., instead of -> co), it's all fine.
Seems like big changes all at once confuse elm-pair?

vid.mp4

Thank you for the detailed report, as usual! I think there's probably some race condition at play here. I plan to give this a look tomorrow!

I introduced this bug in the fix for the undo logic introduced in #10. The undo detection logic would report false positives in the middle of a rename, causing Elm-pair to loose the thread. I made a fix that approaches undo's in a simpler way. Undo still seems to work, and Elm-pair doesn't hang up anymore, at least not when I'm ramming onto my keyboard as quickly as I can :).

The fix is out as release 10, let me know how it works for you! And thank you again for bringing the issue!

Seems to work much better! Thank you @jwoudenberg ❤️