jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Changes in live editing mode lead to infinite "Regenerating project."

Open OLibutzki opened this issue 3 years ago • 5 comments

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.

OLibutzki avatar Sep 29 '21 18:09 OLibutzki

Seems to happen if I have a script file like abc-efg.

OLibutzki avatar Sep 29 '21 18:09 OLibutzki

Weird. So jbang init abc-def and then edit on that reproduces it?

maxandersen avatar Sep 30 '21 00:09 maxandersen

Confirmed. I can reproduce this both on Windows and on Linux. It must be a regression.

quintesse avatar Sep 30 '21 08:09 quintesse

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.

quintesse avatar Sep 30 '21 09:09 quintesse

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.

quintesse avatar Sep 30 '21 11:09 quintesse