Open toddself opened 11 years ago
I'm about to close this since no one else ever reported this issue or added comments to this one.
Is this working better for you now?
Nope :).
Brand new machine -- same issue.
replpad v0.11.8
node v0.10.28 | NewOSX | 8 cpus | darwin platform | v8 v3.14.5.9 | uv v0.10.27
I'll try to look at it one day.
really friggin weird is all I can say
FWIW I'm seeing exactly the same behavior. The first save of any monitored file is detected, but no further changes are.
For me it seems to be related to vim. I can echo
into a file (or even just touch
it), and replpad picks it up just fine. However with vim, it only ever picks up the first save. Once it stops picking up changes, it never starts again. So, if I edit in vim, then touch the file, replpad doesn't trigger.
replpad v0.11.8 node v0.10.29 | xps | 8 cpus | linux platform | v8 v3.14.5.9 | uv v0.10.27
Interesting find, does it work with other editors? Maybe your vim setup is different somehow.
I installed mine via brew install macvim --override-system-vim
.
Overall seems to be a vim issue though since somehow it doesn't trigger the file change event that replpad depends on.
Doesn't matter what editor - vim, sublime, atom, emacs -- all the same result.
I don't imagine vim is particularly unusual in how it writes files, but I can try some other editors tomorrow to confirm.
From a quick glance at your dependencies I'm not sure how you're doing the file watching, but I've successfully used watchr in the past. It certainly works with vim IME.
Cheers,
Ben On 13 Jun 2014 00:12, "Thorsten Lorenz" notifications@github.com wrote:
Interesting find, does it work with other editors? Maybe your guy's vim setup is different somehow.
I installed mine via brew install macvim --override-system-vim.
Overall seems to be a vim issue though since somehow it doesn't trigger the file change event that replpad depends on.
— Reply to this email directly or view it on GitHub https://github.com/thlorenz/replpad/issues/7#issuecomment-45896100.
The watcher stuff is here.
I'm open to have that swapped out with a dependency however. The key is though that it needs to be able to pick up newly created files as well and not fire too often, i.e. twice per save (which some of them do).
Watchr seems to behave well in those regards (I use it to trigger cache invalidation when a new file is created).
I'll see if I can find some time to swap it in, and if it fixes my problem I'll send you a PR. On 13 Jun 2014 00:34, "Thorsten Lorenz" notifications@github.com wrote:
The watcher stuff is here https://github.com/thlorenz/replpad/blob/master/lib/watcher.js.
I'm open to have that swapped out with a dependency however. The key is though that it needs to be able to pick up newly created files as well and not fire too often, i.e. twice per save (which some of them do).
— Reply to this email directly or view it on GitHub https://github.com/thlorenz/replpad/issues/7#issuecomment-45899107.
Would love a PR @benrhughes. Feel free to reach out if you have any questions and/or even submit a semi working PR that we can improve on.
OK, after a bit of investigation, this seems to be a problem with fs.watch, not your watch code specifically. This bare-bones code appears to have the same issue:
var fs = require('fs');
fs.watch('a.js', {persistent: false}, console.log);
process.openStdin().addListener('data', process.exit);
It appears to still be a problem in 0.11.xx too.
I did some testing and it seems that watchr has the same issue (presumably because it uses fs.watch) - I didn't notice before because I'm using it to detect new files, not updates.
According to https://github.com/joyent/node/issues/3172, this is a vim issue (or at least partially a vim issue).
Setting the vim option backupcopy=yes
appears to "fix" things, although it leads to the change being detected (and hence the file being loaded) twice.
Thanks for digging into this. So seems like this can't be fixed in replpad then?
I'm just wondering why @toddself also experiences this with other editors or is it just that the backup=yes
is just a hack that makes it work in vim
and other editors would need another hack?
Also peculiar why I don't have that problem (and I assume it works for lots of others since I haven't heard about this bug from many).
FWIW here is my vimrc maybe I have a setting in there that happens to make it work, although I did turn off swapfiles (not sure how that relates to backupcopy
).
In sublime if you set: "atomic_save": false
in your user preferences it fixes this issue as well in this editor. Perhaps updating the documentation to explain?
Yeah including this in the docs would be nice indeed. We could document how to configure specific editors to play nice with replpad.
I tried setting all the various backup
options in various combinations, still can't make replpad eval once via Vim. :(
I just came across replpad today, installed it, and was experiencing the same issue that @toddself originally reported: replpad would pipe over whatever it found the very first time I saved a file (actually it would pipe it over twice), but would not react to anything after that. Adding backupcopy=yes
to my vimrc seems to have solved the problem.
OS: Mac 10.8.4 iTerm2 replpad v0.11.1
node v0.10.18 | Calvin | 8 cpus | darwin platform | v8 v3.14.5.9 | uv v0.10.15
Editors tried: Sublime Text 3 and vim
Issue:
Launching
replpad .
enumerates the.js
files in the directory. Opening and saving one of them causes replpad to correctly re-read the file.Making more changes and saving it does not ever cause replpad to re-save.