lwblackledge / file-watcher

An open file watcher for Atom that will prompt when the file on disk has changed.
MIT License
34 stars 7 forks source link

Doesn't work when editing files from a mounted directory #12

Open lgb3 opened 8 years ago

lgb3 commented 8 years ago

This package does not work when I'm using Atom to edit files from a mounted directory. The actual files are in a Unix machine, which I'm mounting in my Mac and editing using Atom.

It works when I'm editing a file that is in my Mac though.

ghost commented 8 years ago

I'm also having this issue, or at least experiencing something similar. I have some files on a remote directory, which I'm accessing from a Windows machine and a Linux machine.

With the same file open on both machines, changes on one machine don't show up on the other (e.g. I edit the file on Linux, but the changes don't show up in Atom on Windows). However, if I edit the file with an external editor, the changes will show up on the local machine; for example, editing the file with Vim on Linux makes the changes show up in Atom on Linux, and editing the file with Sublime on Windows makes the changes show up in Atom on Windows. The issue seems to be that changes done from a remote machine don't get caught on any local machines.

The desired behavior of remote edits showing up locally works in Sublime, so I suspect that it should be somehow possible in Atom. I might hack around with the code later and see if I can figure anything out.

lwblackledge commented 8 years ago

I think this might be the same 'lack of notify' issue that affects files mounted via sshfs (#5). How are you sharing/mounting files between the host and guest, samba?

lgb3 commented 8 years ago

I think this might be the same 'lack of notify' issue that affects files mounted via sshfs (#5). How are you sharing/mounting files between the host and guest, samba?

Yes, I'm using Samba for that. I noticed that Atom properly reloads the file when it is changed from outside the editor, and the file lies in the same machine. So maybe this is a more generic problem?

But as "noyouaretheman" said, this works properly in Sublime.

I have a ticket opened in Atom's main repository: https://github.com/atom/atom/issues/12263#issuecomment-236631042

ghost commented 8 years ago

I think this might be the same 'lack of notify' issue that affects files mounted via sshfs (#5). How are you sharing/mounting files between the host and guest, samba?

I'm using NFS. I wouldn't be surprised if this issue is related to #5.

lwblackledge commented 8 years ago

Perhaps something like this can help you? I was considering a similar hacky solution to the mute mount problem. It's all very medieval. https://github.com/rubyruy/watchntouch

lwblackledge commented 8 years ago

Alternatively Samba 4.3 looks like it might have more support for change events: https://wiki.samba.org/index.php/Samba_4.3_Features_added/changed#New_FileChangeNotify_subsystem

lwblackledge commented 8 years ago

Ah! I might be able to put in a config option to switch to use fs.watchFile, if you know you are going to be using a mounted share. Let me look into that.

AlexisWalravens commented 7 years ago

Hi, any update on this ? I recently switched form Sublime to Atom and that's the only feature I'm missing from Sublime. I only work on remote files on a local SMB server. (v4.3.11)

lwblackledge commented 7 years ago

So after a lot of fighting with fs.watchFile and the current solution I was able to get this running for SSHFS. I should be pushing a new version tonight with this as an option.

ghost commented 7 years ago

Thanks!

On Fri, Jan 20, 2017, 08:08 Laurence Blackledge notifications@github.com wrote:

So after a lot of fighting with fs.watchFile and the current solution I was able to get this running for SSHFS. I should be pushing a new version tonight with this as an option.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lwblackledge/file-watcher/issues/12#issuecomment-274109900, or mute the thread https://github.com/notifications/unsubscribe-auth/AK-RXXgt0aqZJnEEgN8MbxrXQ-5BJpdzks5rUNvXgaJpZM4JWana .

AlexisWalravens commented 7 years ago

Hi again,

Both computers are on macOS Sierra, and as I said before the SMB server is on v4.3.11.

lwblackledge commented 7 years ago

@AlexisWalravens:

What concerns me is the 'compare' option reads from the disk directly and should get the latest version that is available. I am wondering if something is happening with Samba and a delay, or some file system peculiarity that is not updating?

lwblackledge commented 7 years ago

I'm going to reopen this temporarily.

AlexisWalravens commented 7 years ago

@lwblackledge

Yep, I don't about the compare option, like I said if I click it it just open a new tab in a new pan with the same file without the changes.

Edit: I made a video : https://cloudup.com/cPGQeFcyl5P

AnthonyWC commented 7 years ago

Reporting that it doesn't work even when 'use Watchfile' after atom reload (unless it requires reboot or unmount)

#apm -v
apm  1.15.3
npm  3.10.5
node 4.4.5 x64
python 2.7.12
git 2.7.4

#atom -v
Atom    : 1.15.0
Electron: 1.3.13
Chrome  : 52.0.2743.82
Node    : 6.5.0

#sshfs -V
SSHFS version 2.8
FUSE library version: 2.9.4
fusermount version: 2.9.4
using FUSE kernel interface version 7.19
AirAddicted commented 7 years ago

Hi, this issue still exists so I'd like to provide you more info.

I'm using Atom on Windows and a SMB network drive. Whenever I change a file using external editor, Atom immediately shows that there are unsaved changes and the name of the file in an opened tab changes (from "_filename.txt - project_name" to "_filename.txt~"). When using WatchFile, sometimes notification appears but Compare and Reload just open a blank file. When using Reload the filename still is "_filename.txt~" which might be the reason why it doesn't work the same way as for local files

Edmundod commented 7 years ago

This issue also exists for me. I mount a directory from computational server by SSHFS and open file which contains numerical results. Every time my computation is done it adds a new results to the file. Unfortunately I don't see them in atom. Closing file and reopening works, but that's not a solution. My settings are:

What's interesting, when "Prompt on Change" is ON, then everything works fine. But of course it's amazingly annoying, because file changes very frequently. Another interesting thing, nano also doesn't show new lines even when I turn it off and on. But it shows from another terminal window. Vim and tail works ok.

danutchereches commented 6 years ago

Forget the 'lack of notify'. Why don't you check if the file was changed on focus? (like eclipse, gedit and many other apps) And also, more importantly, on save.

lwblackledge commented 6 years ago

New version should help - there have been some updates to Atom that I needed to accommodate