Skip to content

feat(search): ask for confirmation before replace all - #3051

Open
youssefm1 wants to merge 2 commits into
Acode-Foundation:mainfrom
youssefm1:confirm-replace-all
Open

youssefm1 wants to merge 2 commits into
Acode-Foundation:mainfrom
youssefm1:confirm-replace-all

Conversation

@youssefm1

Copy link
Copy Markdown

Closes #3045

Replace All in Search in files now shows a confirm dialog first, e.g. "Replace 12 matches in 3 files?". If you cancel, nothing changes and the running search isn't stopped.

  • added the replace all confirm string to all lang files (English text for now) and to index.d.ts
  • the dialog only shows when there are results, otherwise replaceAll behaves like before

I haven't built the APK for this one, so I couldn't try it on a device yet.

@github-actions github-actions Bot added the translations Anything related to Translations Whether a Issue or PR label Nov 12, 2026
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the approved file list now stays fixed during confirmation.

Summary

Replace All now asks for confirmation and keeps the approved file list fixed.

  • Search in files asks before replacing the results it has found.

The previous finding is fixed: results arriving during confirmation no longer expand the files being replaced. No new actionable issues were found.

Reviews (3) · Last reviewed commit: "fix(search): only replace files that wer..." · Reviewed by Greptile

Comment thread src/sidebarApps/searchInFiles/index.js Resolved
results kept coming in while the dialog was open, so replace all could touch files that weren't in the count
Comment on lines +946 to +953
if (files.length) {
const confirmed = await confirm(
strings.warning,
strings["replace all confirm"]
.replace("{matches}", resultOverview.matchesCount)
.replace("{files}", files.length),
);
if (!confirmed) return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor edge case: replacing is still false while the dialog is open, so a refresh / add-folder / remove-folder event from files can still run onInput in that window. It clears the results and schedules a new search 500ms later. If the user then taps OK, that search can be sent to the same workers doing the replace, and its done-searching calls terminateWorker(false), which can cut the replace short.

Bailing out if the search changed while the dialog was open would close this:

Suggested change
if (files.length) {
const confirmed = await confirm(
strings.warning,
strings["replace all confirm"]
.replace("{matches}", resultOverview.matchesCount)
.replace("{files}", files.length),
);
if (!confirmed) return;
if (files.length) {
const version = searchVersion;
const confirmed = await confirm(
strings.warning,
strings["replace all confirm"]
.replace("{matches}", resultOverview.matchesCount)
.replace("{files}", files.length),
);
if (!confirmed || version !== searchVersion) return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

translations Anything related to Translations Whether a Issue or PR

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Search in files: confirm before replace-all

2 participants