jbang
jbang copied to clipboard
Changes in live editing mode lead to infinite "Regenerating project."
jbang Version 0.80.2
Using Windows 10 I have a problem while editing jbang files in live editing mode. I tested with Eclipse and VS Code.
Whenever I save a edited script jbang logs Regenerating project.
infinitely.
Seems to happen if I have a script file like abc-efg
.
Weird. So jbang init abc-def and then edit on that reproduces it?
Confirmed. I can reproduce this both on Windows and on Linux. It must be a regression.
Preliminary debugging seems to indicate that the project gets reset back to its original state (because my edits keep getting lost), which then triggers a new watch event.
Ok, found it. It has to do with the fact that when you edit a file that has an invalid name a copy will be made in cache/scripts
with a valid name. And right now that file gets re-copied on every event causing the endless loop.
The fix is easy enough.
But in general I think making a link instead of a copy is a better solution, right? Perhaps only making a copy when making a link doesn't work? Will try that out and see if anything breaks.