your-tools / ruplacer

Find and replace text in source files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support multiline replace

icco opened this issue · comments

I have the following in a lot of files:

          Log.send(
                new LogData(
                    this.baseData,
                    `${this.tryGetPingMatterLinkedToUser.name}.ts`,
                    userId,
                    Level.Warn,
                    `Dms client matter code: ${filedDocument.DmsClientMatterCode()} does not exist in Ping`
                )
            );

I want to replace all with logger.error(error).

I tried lots of different things, but I expected ruplacer 'Log\.send\((?s:.)*\);' 'logger.error(error)' -t ts to work, but it does not. Any thoughts?

Adding some context here: Current behavior's limitation to single-line changes is because ruplacer's logic is very baked against processing individual lines at the moment. For reference in main ATOW, see:

I don't see a technical reason that ruplacer couldn't do multi-line edits, but it would involve some major shifts to ruplacer's UX.