JannisX11 / batch-rename

VS Code extension to batch-rename files
https://marketplace.visualstudio.com/items?itemName=JannisX11.batch-rename-extension
MIT License
56 stars 16 forks source link

Fails silently with Rewrap #16

Open karlhorky opened 1 month ago

karlhorky commented 1 month ago

Hi @JannisX11, thanks for the amazing extension! Super helpful.

I am trying to use this while Rewrap is enabled with "rewrap.onSave": true.

When I save the file (manual save, not an auto-save on loss of focus), Rewrap tries to wrap short lines onto the same line, causing chaos in the file for Batch Rename, which fails silently (no error message or easy way to debug).

Would there be a way to enable usage of Batch Rename with Rewrap using this setting?

My current workaround is to disable Rewrap and then re-enable it every time that I use Batch Rename, but I would like to avoid this extra friction if possible.

Eg.

  1. I could imagine a setting that would apply Batch Rename changes when the editor tab containing the file names is only closed, instead of manually saved. Then I could just close the tab and Rewrap would not trigger.
  2. Or if there were a way to communicate to Rewrap that this particular file type should not be wrapped, that also seems like a possible solution.
JannisX11 commented 1 month ago

You should be able to use per language settings to only enable rewrap on file types where you need it, or to disable it on txt files, which is what batch rename uses.

karlhorky commented 1 month ago

That sounds reasonable.

However, I use Rewrap on text files sometimes... 🤔

Would Batch Rename be open to using a different format? Eg. maybe some unrecognizable proprietary format like BatchRename file format, to eliminate possible conflicts with other tooling that deals with Plain Text files...