lwblackledge / file-watcher Goto Github PK
View Code? Open in Web Editor NEWAn open file watcher for Atom that will prompt when the file on disk has changed.
License: MIT License
An open file watcher for Atom that will prompt when the file on disk has changed.
License: MIT License
Thanks for a great package! I was surprised Atom doesn't have this feature by default, as it can destroy changes made outside of Atom...
However, it would be nice to be able to keep Atom's current version before loading the changed on-disk version of the file.
This could be done by either saving a backup version or (preferably) open a new tab with Atom's version of the file, before reloading the on-disk version.
[Enter steps to reproduce:]
Atom: 1.19.0-beta1 x64
Electron: 1.6.9
OS: Mac OS X 10.12.4
Thrown From: file-watcher package 1.1.0
Uncaught TypeError: this.editor.buffer.updateCachedDiskContents is not a function
At /Users/hperrin/hperrin-configs/atom/packages/file-watcher/lib/file-watcher.coffee:88
TypeError: this.editor.buffer.updateCachedDiskContents is not a function
at FileWatcher.module.exports.FileWatcher.forceReload (/packages/file-watcher/lib/file-watcher.coffee:88:22)
at FileWatcher.module.exports.FileWatcher.confirmReload (/packages/file-watcher/lib/file-watcher.coffee:103:8)
at /packages/file-watcher/lib/file-watcher.coffee:62:10)
at emitTwo (events.js:106:13)
at StatWatcher.emit (events.js:191:7)
at StatWatcher._handle.onchange (fs.js:1376:10)
atom-autocomplete-php 0.25.6
atom-material-ui 2.0.4
atom-typescript 11.0.4
autoclose-html 0.23.0
busy-signal 1.4.3
color-picker 2.2.5
emmet-simplified 2.5.0
file-icons 2.1.8
file-watcher 1.1.0
git-plus 7.9.3
gl-light-syntax 3.0.0
highlight-selected 0.13.1
intentions 1.1.2
javascript-snippets 1.2.1
line-diff-details 1.8.0
linter 2.2.0
linter-csslint 1.3.4
linter-eslint 8.2.1
linter-phpcs 1.6.7
linter-tidy 2.3.1
linter-ui-default 1.6.2
minimap 4.28.2
minimap-git-diff 4.3.1
minimap-highlight-selected 4.6.1
minimap-linter 2.0.0
pigments 0.39.1
resize-indent 0.3.0
slack-ui 0.8.0
spacegray-light-neue-ui 0.1.7
tab-switcher 1.5.4
todo-show 1.11.0
tree-view-git-status 1.4.0
When I do git checkout master
after working on my branch, I get 57(†) prompts to reload files. If I want to ignore them all, there is a nice big "Ignore All" button; but if I want to reload them all, there is no "Reload All".
† This may be hyperbole
This is intended to be a feature request.
file-watcher prompts that a file has changed, but clicking Reload (or using Reload Automatically) closes the file without reloading.
It works when I change the file in e.g. notepad, but when I checkout into another commit or branch with git it won't reload the file.
I am using Atom 1.10.2 & editing my file in PyCharm.
When I change the file in PyCharm, I get a prompt that the file was changed, but when I hit "Reload", the file just closes, and does not reload.
I think it has to do with Atom messing with the file too: whenever a change was made to it by another process, Atom automatically loads the old version as 'filename.ext__jb_old__' (and closes the original). So the dialog I get from file-watcher actually refers to 'filename.ext__jb_old__' as the file that was changed!
TL; DR: I believe a change in the latest Atom version is causing that problem but since I just started using it I do not know for sure.
Whenever Atom gets reloaded or the package is disabled I see the following stack trace in the console:
Error deactivating package 'file-watcher' TypeError: Cannot read property 'destroy' of undefined
at FileWatcherInitializer.deactivate (file:///C:/Users/Landon Abney/.atom/packages/file-watcher/lib/init.coffee:39:16)
at Package.module.exports.Package.deactivate (C:\Users\Landon Abney\AppData\Local\atom\app-1.12.0-beta1\resources\app.asar\src\package.js:668:20)
at PackageManager.module.exports.PackageManager.deactivatePackage (C:\Users\Landon Abney\AppData\Local\atom\app-1.12.0-beta1\resources\app.asar\src\package-manager.js:632:12)
at C:\Users\Landon Abney\AppData\Local\atom\app-1.12.0-beta1\resources\app.asar\src\package-manager.js:618:19
at Config.module.exports.Config.transact (C:\Users\Landon Abney\AppData\Local\atom\app-1.12.0-beta1\resources\app.asar\src\config.js:312:16)
at PackageManager.module.exports.PackageManager.deactivatePackages (C:\Users\Landon Abney\AppData\Local\atom\app-1.12.0-beta1\resources\app.asar\src\package-manager.js:612:19)
at AtomEnvironment.module.exports.AtomEnvironment.unloadEditorWindow (C:\Users\Landon Abney\AppData\Local\atom\app-1.12.0-beta1\resources\app.asar\src\atom-environment.js:815:21)
at WindowEventHandler.module.exports.WindowEventHandler.handleWindowBeforeunload (C:\Users\Landon Abney\AppData\Local\atom\app-1.12.0-beta1\resources\app.asar\src\window-event-handler.js:212:30)
at C:\Users\Landon Abney\AppData\Local\atom\app-1.12.0-beta1\resources\app.asar\src\window-event-handler.js:3:59
Currently seeing this on Atom v1.12.0-beta1, but I've been seeing it for a while.
This is a feature request not a bug report.
File Watcher fails to simultaineously work with PyCharm. Seems like PyCharm first renames the original file (appends __jb_old__
) then writes modified file as new file with old unmodified name. So the file in Atom only changes it's name (name + __jb_old__
).
I need this feature to write code in PyCharm and to execute via Atom-Hydrogen-Jupyter.
PS
Though Notepad++ works with PyCharm flawlessly.
UPD
This is actually a PyCharm "safe write" function. If disable it then everything works OK. But still PyCharm (and other JetBrains software) support may be a good feature.
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.
When you close a new file without saving it, it throws an error:
TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.resolve (path.js:1148:7) at Object.fs.unwatchFile (fs.js:1558:25) at FileWatcher.module.exports.FileWatcher.destroy (/home/julienc/.atom/packages/file-watcher/lib/file-watcher.coffee:128:9) at /home/julienc/.atom/packages/file-watcher/lib/file-watcher.coffee:52:8 at Function.module.exports.Emitter.simpleDispatch (/usr/lib64/atom/node_modules/event-kit/lib/emitter.js:25:14) at Emitter.module.exports.Emitter.emit (/usr/lib64/atom/node_modules/event-kit/lib/emitter.js:129:28) at TextEditor.module.exports.TextEditor.destroyed (/usr/lib64/atom/src/text-editor.js:534:27) at TextEditor.module.exports.Model.destroy (/usr/lib64/atom/src/model.js:31:58) at Pane.module.exports.Pane.destroyItem (/usr/lib64/atom/src/pane.js:645:18) at atom-tabs.TabBarView.onClick (/usr/lib64/atom/node_modules/tabs/lib/tab-bar-view.js:711:17)
Hi,
I started using file-watcher only today, and it seems AutoReload function could do a little better job. The idea would be to force-reload changes only if there are no unsaved changes, otherwise, ask to confirm. Otherwise, when it simply force-reloads everytime, I can't really find a lot of use for it...
An even better idea would be to ask for confirmation only if there are conflicting lines, and merge automatically if changes are unrelated to unsaved edits, but I imagine that can be harder to implement.
File watcher only seems to prompt if atom file has unsaved edits.
Other editors will prompt whenever the file changes, even with no pending edits
not working from encoding windows1252
Uncaught (in promise) Error: Invalid encoding name: windows1252
Not sure if this intended behaviour, or it can be changed at Atom config level, but if a file is changed the dialog displayed by file-watcher causes Atom to come to the foreground which is unwanted.
[Enter steps to reproduce:]
Atom: 1.19.3 x64
Electron: 1.6.9
OS: Linux Mint
Thrown From: file-watcher package 1.2.4
Failed to load the file-watcher package
At unexpected = in /home/nighty/.atom/packages/file-watcher/lib/file-watcher.coffee:88:81
SyntaxError: unexpected =
at /packages/file-watcher/lib/file-watcher.coffee:88:81
atom-beautify 0.30.5
atom-cli-diff 1.9.0
atom-django 0.3.2
atom-meld 0.3.5
atom-python-virtualenv 0.14.0
atom-transpose 0.3.4
autocomplete-python 1.10.2
blame 0.12.0
busy-signal 1.4.3
custom-title 1.0.1
data-atom 0.25.2
DjangoRAD 0.0.1
emmet 2.4.3
emmet-snippets-compatibility 1.0.6
file-watcher 1.2.4
git-plus 7.9.3
git-time-machine 1.5.9
hyperclick 0.1.3
indent-guide-improved 1.4.13
intentions 1.1.5
language-django 0.1.1
language-nginx 0.8.0
linter 2.2.0
linter-pycodestyle 2.1.2
linter-pylint 2.1.0
linter-ui-default 1.6.7
local-history 4.3.0
merge-conflicts 1.4.5
minimap 4.29.6
minimap-linter 2.0.2
monokai 0.24.0
open-html-in-browser 0.2.0
open-terminal-here 2.3.1
persistent-undo 1.2.0
project-manager 3.3.5
python-tools 0.6.9
selection-highlight 0.1.6
sort-lines 0.14.0
symbols-tree-view 0.14.0
tag 0.5.0
termination 0.6.0
up2date 0.1.2
Zen 0.18.0
When making a change to file using emacs, no prompt is made to atom.
Would it be possible to add a setting so one could use a different differ?
ie "split-diff"
I'm working on an ePub and very often unzip it to edit it's contents.
It involves using a script to unzip the .epub package. The script gets rid of the old folder first and then creates a new one with the same name. I understand that file-watcher is just loosing track of the original files therefore it's not reporting any changes in the files. It would be nice to have this functionality. Even worse is that atom itself requires to close the current file and open it again from tree view.
To reproduce:
I hope you see the problem. I'm not sure if it's atom's issue but i hope you could add this functionality to you plugin.
Cheers!
When I use TortoiseGit - revert command, Atom don't show file in reverted state! I still see my file with local changes.
Hi,
I have Ubuntu 16.04.3 LTS, and I installed recently the latest file-wacher from Atom packages.
I have a file on a NFS mount, which I change outside of Atom. Atom reloads it automatically without prompting there was a change.
I have checked the "Prompt on change" check-box in settings.
I also checked "Use WatchFile --RELOAD REQUIRED", since my file is on a mounted file system.
Regards,
Mirela
Hello!
After losing some work with Atom due to git reset
, I discovered you plugin but seems it is not working with the latest Atom and macOS.
Can you take a look at it? Is there something that I can do to help?
Thank you! This plugin really fixes an annoying problem with Atom =)
prevent atom from removing split screen on reloading document
This bug is repeating a few things in other watch posts, but I wanted to collect my bugs here:
If Atom is not in focus, it does no reloading
It always automatically reloads if there's no edits in Atom
It never reloads if there are edits in Atom
Version: Atom 1.29.0 x64 Windows
I have "Prompt on Change" and "Include the compare option" checked. "Reload Automatically" is UNCHECKED but the settings are completely disregarded.
I tried with the "Use Watchfile" on - it sort of worked, but inconsistently. It will work once, but then if I reload as instructed it goes back to the broken behavior. Even if it is ON and I turn it OFF without reloading, I get asked properly.
It looks likes initialization just doesn't apply the options at all, and defaults to reloading automatically if there's no edits.
Hi, as the title says, that makes users be able to apply one action to all changed files at once. That would be more convenient. Thanks!
Without the annoying message?
Hi,
thank you for this plugin. I use it daily.
When a file is changed I get a pop-up regardless of the file being in the front or a tab in the background.
It would be nice to have a option to only get notified on selection of the file...
Thanks,
73
I'm on SSHFS on Linux, so I started using the WatchFile option. That option works great and I'm now getting notified when I wasn't before, but the only problem is, if I've had a file open previously and then closed its tab, I'll still get notifications for that file even after it's closed. I thought it could be related to the Prompt on Change option, but I want to keep that option on for files that I still have open.
Subj, (also somehow related to #7 and #10 but not the same). Say one file is changed 3 times before I switch to Atom and get the pop-up. So when I switch to Atom, instead of getting one pop-up for the same file for the 3 changes together, I get two or more pop-ups, one for each change, on the same file.
I didn't check the internals, but it looks like file-watcher queues every change separately and asks about each of them. It would be much better to ask for reload of the same file just once treating all the changes as a single change.
Hello
i'm using atom with filezilla. But when file change on disk, no prompt message to warn me.
Steps to reproduce :
When I change branchs I get annoyed by the reload popup.
Isn't there a way to check if the branch has been changed and not ask for reloading?
Hello,
I like this package a lot thank you.
One thing which is unfortunate is when you use the compare option there is no highlighting of diffs.
On my installation I have fixed that by installing the split-diff package and triggering it when the compare happens.
It is a one line change
atom.commands.dispatch(document.querySelector('atom-text-editor'), 'split-diff:toggle')
added after line 80 of file-watcher.coffee
It would obviously be better if a service api existed on split-diff but in the meantime I think this would be a worthwile improvement
I like this plugin for confirm if file modified in another
but can this work in visualcode ?
because I still work with atom because this plugin, but atom just still until this end year, so will migrate to visualcode but I'm not got plugin like this (confirm if detect modified in another applications)
can somebody give information for this ?
It would be nice if instead of notifying me for each change, I would have the option the ignore all future changes to a file and only view the current state.
This is especially useful for log files that are still active.
I have a Problem with files which have changed in my VM. I work with a VM (Debian) in virtualbox which is mounted via sshfs on my mac.
If I edit files on my mac, the vm recognize the changes, but atom doesn't recognize changes, which were made in the vm.
Have you an idea why i have this problem?
Hi, just installed Atom and file-watcher on Fedora 28 KDE.
If I have an open file on Atom and on another editor, any change made outside is automatically loaded on Atom without any prompt, even with the setting "Reload Automatically" turned off.
I have tried with settings "Use WatchFile" and "Include the Compare option" turned on an off, to no avail.
Thanks.
All filesystems with open files are mounted filesystems by necessity. Surely you meant to say "Network file systems"?
I have a fresh Atom setup (v1.4.3) on Windows 10 Pro (x86), with the "file-watcher" package installed. "Include the Compare" and "Prompt on Change" options are enabled. I create a file in Atom, put some contents in it, and save it to "D:\123.txt". I then open this file in another text editor, add more contents to it, and save it. I then switch back to Atom (which i didn't close, and inside which I still have the "D:\123.txt" file open) and there is no prompt of any kind informing me that the file has changed on disk.
To reproduce that you must edit a file in atom, don't save it. Close atom.
Modify the file externally.
Open atom. The external change is lost
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.