Reduce how much text needs to be diffed when computing cursor positions (#15709)

Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
Mark Ameryandfisker Cheung authored and GitHub committed 2024-09-27 21:35:32 +08:00
1 parent a4be6a0fde
commit d28d40ac0c
18 files changed
+392 -67

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
#### Fix `cursorOffset` feature sometimes being catastrophically slow (#15709 by @ExplodingCabbage)
Previously, Prettier's `cursorOffset` feature would be spectacularly slow in certain unfortunate circumstances (namely when the user's cursor was not contained within a leaf node of the AST, and the non-leaf node containing it was very large and being significantly reformatted by Prettier). As a consequence, if you used Prettier via an editor integration that used `cursorOffset` under the hood, your editor would sometimes inexplicably hang when you tried to format a file.
All examples of this phenomenon that we are aware of should now be fixed, but bug reports of any further pathological examples would be welcome.