jbang
jbang copied to clipboard
fix: Prevent jbang edit --live from entering endless loop
Also using links now for files with improper names.
Fixes #1027
Darn, the link change doesn't work because now the watch doesn't detect any changes :-)
So what to do now @maxandersen ? Set the watch on the original folder perhaps?
Edit: Or even on each of the edited files instead of the folder.
Wait - why does this change affect watch? Watch if java files work so why would that change for differently named files ?
Because right now they get copied to the jbang cache with a "proper" name and then that copy is being used by edit
. So the edits never end up back in the original file. This must have been like this for a long time already because that mechanism is pretty old.
So that's why I thought to change it to using links instead of making a copy, but then the watch doesn't work anymore (because links don't change when you edit the file they point to, obviously). So then the next step would be to not watch the temp project folder but the actual individual files. Because that way you can watch the original file (called abc-def
) but give the link (named AbcDef.java
) to the edit command.
It sounds all a bit complicated perhaps, but it should work.
I'll need to look as I've been using edit for ages and the edit happens on original file not cache.
I'll need to look as I've been using edit for ages and the edit happens on original file not cache.
Sure, but you perhaps never did on files with invalid names?
im not questioning that invalid names have an issue just not grokking why file watching wouldn't work just because the filenames changes... myapp.java is also symoblically linked...not copied.
myapp.java is also symoblically linked...not copied.
They're symbolically linked into the cache/project
folder , yes. But before that happens files with illegal names are first copied to a file with a "proper" name under cache/scripts
... and then they are linked to cache/project
. So it's a double indirection.
okey I grok the issue now - yeah; there aren't a good real quick fix - we'll need to skip the caching when editing and then do rename via link.
we'll need to skip the caching when editing
Hmm that's probably going to be ugly in some way because that's pretty deep down into the ResourceRef
code. And when you start getting into those weird little opt-outs for special cases it often means you have the wrong abstraction.
So why not watch the original file (before rename) as I suggested? Wouldn't that be an option?
Yes that could work.
@quintesse you Wanna finish this one ?
Will do. 👍
@quintesse still an issue you wanna fix? if yes - lets keep it open but if not lets close it to not take up mental space :)
I'm okay with closing it 👍