chore(code/find): reimplement replace all

This commit is contained in:
Elian Doran
2025-05-13 09:42:31 +03:00
parent b646475018
commit 3ace3d9ed9
3 changed files with 17 additions and 17 deletions

View File

@@ -61,23 +61,7 @@ export default class FindInCode {
}
async replaceAll(replaceText: string) {
if (!this.findResult || this.findResult.length === 0) {
return;
}
const codeEditor = await this.getCodeEditor();
const doc = codeEditor?.doc;
codeEditor?.operation(() => {
if (!this.findResult) {
return;
}
for (let currentFound = 0; currentFound < this.findResult.length; currentFound++) {
let marker = this.findResult[currentFound];
let pos = marker.find();
doc?.replaceRange(replaceText, pos.from, pos.to);
marker.clear();
}
});
this.findResult = [];
codeEditor?.replaceAll(replaceText);
}
}