atom / find-and-replace

Find and replace in a single buffer and in the project
MIT License
242 stars 196 forks source link

Replace "Editor is not responding" with progress indicator on large find/replace #1096

Closed wbt closed 4 years ago

wbt commented 5 years ago

Description

I have a moderately large (~4MB) single-line JSON file that I opened with Atom. (Also observed in safe mode).
The file opens, though without syntax highlighting. In an effort to make the file more readable, I try doing a Find }, with Replace },\r\n in the file. I have to do this in regex mode because of the newline in the Replace. There are about 25K results found.

This message pops up pretty frequently for a moderately long period (>1 hour): Editor is not responding - screenshot

If I open Task Manager, it generally looks like the processing continues while the message is displayed, but in terms of UI it seems like I have to keep clicking on the "Keep waiting" option in order for the processing to continue.

It's also not clear if the program is working or if it's hung completely and I should just exit the program. Doing the same find/replace with a shorter file, after one or a small number of these the process does complete successfully, but when it's been over an hour it becomes less clear whether it will eventually succeed or not, and it becomes more likely the user will accidentally hit "Force Close" simply because there are so many of these popups (and that's the default).

It would be better if Atom had some visual indicator regarding progress of the find/replace. For example, the background of the Replace input field could become a progress bar, filling up as the replace operation proceeds, as more and more of the 25K results get replaced.

Simply assuming that all find/replace operations will happen so fast the user won't notice is inaccurate.

Simply adjusting the number of results found would not work in this example, where the "find" query is also in the "replace" string.

Versions

atom --version: Atom : 1.23.2 Electron: 1.6.15 Chrome : 56.0.2924.87 Node : 7.4.0

apm --version: apm 2.4.2 npm 6.2.0 node 10.2.1 x64 atom 1.40.0

Windows 10

rsese commented 4 years ago

Thanks for the feedback :+1: I chatted with the other maintainers and we're going to go ahead and close in favor of https://github.com/atom/find-and-replace/issues/653. It's not the exact same issue but your suggestion is something that can be considered along with the general issue where find and replace is slow/can freeze Atom.

wbt commented 4 years ago

In my view, I think these are separate issues. #653 is about fixing the underlying slowness to make the process go more quickly. I support that, and it'll help. However, no matter how fast that gets, there will always be some files that are large enough that Atom is just going to take a long time to process find/replace. Those cases won't be as common when the operation is faster, but they won't go to zero.

This Issue (which is more applicable for the last comment in that one) requests the replacement of "Editor is not responding" with a progress indicator. I still think that's a good idea and if it were up to me, I'd reopen this (while also leaving the other one open to address performance).

Polydynamical commented 3 years ago

Yes I agree a progress indicator would be very helpful in determining if Atom is truly crunching through the find and replace or it has crashed.