Hi @newinnovations, it has been a while. Lately I am not using this plugin as much as I 'd like, however, I found sometime to write some code.
This PR introduces auto-refresh by checking the remote file(s) every N seconds. N comes from config and by default is 0 (disabled). The check is based on lastLoad and lastModified attributes which in turn are based 100% on the remote fs.stat() (no time parameters from the local machine). The behaviour is as follows:
If remote is modified and local file is not, automatically reload the tab's content to reflect the remote changes
If both remote and local files are modified, display a banner (see later) to ask the user to either ignore the changes or reload the file. This is a bit more risky since reloading from the remote will result in losing the local buffer content and thus the user is responsible for choosing. If the user chooses to "Ignore" the changes, then the remote check is being disabled until the user saves the file. After saving, we restart the remote file check
Now, the banner mentioned above is a bit hackish. The reason is that atom notifications cannot do the job because (1) they are not persistent and (2) they float which means the notification might be for another tab the user doesn't see currently.
Being a bit lazy, I am just adding a new div on top of the atom-editor element. Each editor is associated with its own banner (ie banner not shared between editors). Furthermore, the banner has not been styled too much and might look a bit funny:
Caveats:
This was only tested without the "Close connection after every upload" option (ie tested only with persistent connections)
Tested with 3-4 files open at the same time. It might misbehave with tens of them open (we might want to consider connections to be shared amongst tabs in the future)
I have tested few scenarios (like conflict happening when the user is on another tab) but more testing is needed, thus option flagged as experimental
Hi @newinnovations, it has been a while. Lately I am not using this plugin as much as I 'd like, however, I found sometime to write some code.
This PR introduces auto-refresh by checking the remote file(s) every N seconds. N comes from config and by default is
0
(disabled). The check is based on lastLoad and lastModified attributes which in turn are based 100% on the remote fs.stat() (no time parameters from the local machine). The behaviour is as follows:Now, the banner mentioned above is a bit hackish. The reason is that atom notifications cannot do the job because (1) they are not persistent and (2) they float which means the notification might be for another tab the user doesn't see currently.
Being a bit lazy, I am just adding a new div on top of the atom-editor element. Each editor is associated with its own banner (ie banner not shared between editors). Furthermore, the banner has not been styled too much and might look a bit funny:
Caveats: