Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watched files are not being uploaded automatically #278

Closed
Jany-M opened this issue May 10, 2016 · 25 comments
Closed

watched files are not being uploaded automatically #278

Jany-M opened this issue May 10, 2016 · 25 comments

Comments

@Jany-M
Copy link
Contributor

Jany-M commented May 10, 2016

Hello!
Using remote-sync 4.1.0 and Atom 1.7.3

I added some files to be watched from the GUI panel and I get the notification that they are being watched. However, automatic upload doesnt work upon file change.

If I manually click on Monitor File (the old way), I can see an M icon (doesnt happen with above case though) next to the file in tree view, the notification that file is being watched, but again the file is not uploaded automatically upon change.

Basically, monitoring is now broken, whatever way I try, even the old way.

@elistone
Copy link
Contributor

@Jany-M could you give me some details about what OS you are using?
After added files to be monitored have you restarted atom?
Are you sure you are adding the correct path to be automatically followed? A good way to check this is to go to the file you are trying to auto watch: right click > Copy Project Path remembering to add the beginning slash.

@Jany-M
Copy link
Contributor Author

Jany-M commented May 11, 2016

Win10 64bit.
I have restarted it yes.

I have added them to the config GUI like this:
/assets/css/responsive.css, /assets/css/extended.css
and I saw the blu notification:
remote-sync: Currently watching: the 2 files

In the json they show like this:
"watch": [ "/assets/css/responsive.css", "/assets/css/extended.css" ]

I dont see any M icon next to those files though.
Only if I manually right click on the file, in tree view, and then click on Monitor File, then the M icon shows up and I get the notification of file being watched.

.css files dont get uploaded automatically anymore though.
Not if I put them in the watch config, nor if I just monitor them manually (the whole monitoring is basically just broken now).

@elistone
Copy link
Contributor

Rather strange I am running same OS and do not have the issue, the fact you are seeing the remote-sync currently watching implies that when starting up, it is 'watching' the files as checks are made beforehand that the file is actually found.

As for the M not being shown this is more of a style thing (which could be an issue with finding the file or not having time to apply the effect) but I don't class it as a major issue at the moment.

As for a few tests, can you one open atom and using ctrl+P look for Remote Sync: Monitor Files List this should output the files that you are currently monitoring (just to check they are still in the list once loading is complete)

After that test, could you remove all items from the watch list restart atom & just try doing the manually right click method to help try and narrow it down for me, as I cannot replicate your issue.

Thanks

@Jany-M
Copy link
Contributor Author

Jany-M commented May 11, 2016

@elistone, after some testing:

  • removing the watched files from the config panel, restarting Atom then manually monitoring the files works (watched file is uploaded automatically)
  • if then i open the command palette and click on Remote Sync: Monitor Files List, in the notice I can still see the old files (even though they are not in the config anymore and in the file it says "watch": []). If I restart Atom, the old files dont show up anymore in the List
  • when i add files manually, and click on Remote Sync: Monitor Files List, nothing happens (no notice)

So basically, the old manual way works but only if theres no files being watched in the config file.

I use the keyboard-localization package (it_IT), if that's of any use, but I tested the above with it disabled.

@enoversum
Copy link

If I may chime in, I just experience the same on Windows 10 x64. After learning how to put the slashes, Atom finally finds the right file to watch after a restart of the app, the fat M icon appears next to the css file, but it is not being uploaded when changing the .scss file. And I have checked the css file if the change actually applied - yes, the file has been changed, but is not being watched even though it says so :/ .

@Jany-M
Copy link
Contributor Author

Jany-M commented May 13, 2016

had to downgrade to 4.0.1. Hopefully this watch issue is resolved in next version.

One more thing btw: in 4.0.1, when I manually watch for a file, in the popup notice it shows the full path to file. While in 4.1.0 it only shows the file name and extension. Maybe it's nothing, thought I'd share.

@yongkangchen @elistone

@elistone
Copy link
Contributor

@Jany-M @enoversum I am struggling to replicate this issue on my machine, and will need access to one with the issue to solve it, you are welcome to look into the issue your self and put in a pull-request.

@Jany-M
Copy link
Contributor Author

Jany-M commented May 16, 2016

@elistone @yongkangchen
Since I've never debugged an Atom package, nor have I ever used .coffee, do you have any advice on how I could log to console the full path of files being watched and if the watch listener is actually being fired + whatever object we may find useful to inspect?

  • chokidar lib updated to v 1.5.0 6 days ago, just like the latest remote-sync, any chance it could be the an issue with that latest v? since remote-sync 4.0.1 used an older version of it, 1.4.3, and works fine?
  • Is it possible that the issue could reside in the monitored file not being matched correctly (path?) anymore, in 4.1.0?
  • tested on win7 64bit and it doesnt work on there either (so it's not just a Win10 thing)

@elistone
Copy link
Contributor

elistone commented May 17, 2016

@Jany-M to console log the full paths being watched you can do the following:

Open the installed package

  • Open settings
  • Go to packages
  • Find remote-sync
  • Click to view more
  • Click view code

Locate the watching methods

Found in lib/RemoteSync.coffee - the monitor files methods are found from line 115 - 220

The method you are most likely looking for is the mointorFile method found on line 132 this is where the files are checked to see if they can be watched, if we want to enable toggle and display notices. I would start by console logging the dirPath that enters this method and go from there.

Example:

monitorFile: (dirPath, toggle = true, notifications = true)->
     console.log "dirPath",dirPath

to view the console log you will need to open up the inspector inside atom which can done with the key-bindings ctrl + alt + I

Important you will need to reload atom after to see changes take effect. (ctrl + alt + R)

By the way coffeescript is very similar to javascript apart from using indentations, I would recommend using something like http://js2.coffee/ to help work out what is going on.

@Jany-M
Copy link
Contributor Author

Jany-M commented May 17, 2016

Thank you @elistone!
Question... any reason why, both after uninstalling and also after emptying .atom/storage, .atom/.node-gyp .atom/compile-cache ... the remote-sync the package looks kinda greyed out in the community packages search list (can be installed without issues, I'm just curious)?

17-05-2016-09-39-39

@Jany-M
Copy link
Contributor Author

Jany-M commented May 18, 2016

@elistone @yongkangchen I console logged the paths for each relevant method, while using the config watchlist.

monitorFile dirPath W:\Dropbox\__atom__\project1/css/style.css (wrong slashes)
for file in MonitoredFiles file_name replace 1 W:\\Dropbox\__atom__\project1/css/style.css (wrong slashes)
for file in MonitoredFiles file_name replace 2 W:\\Dropbox\\__atom__\\project1/css/style.css (wrong slashes + double slashes)
setupAutoFileWatch fullpath W:\Dropbox\__atom__\project1/css/style.css (wrong slashes)

setupAutoFileWatch filesName /css/style.css (wrong slashes)
initAutoFileWatch projectPath W:\Dropbox\__atom__\project1 (correct)

When I manually watch the file though, here's what happens:

monitorFile dirPath W:\Dropbox\__atom__\project1\css\style.css (correct)
for file in MonitoredFiles file_name replace 1 W:\Dropbox\__atom__\project1/css/style.css (wrong slashes)
for file in MonitoredFiles file_name replace 2 W:\\Dropbox\\__atom__\\project1/css/style.css (wrong slashes + double slashes)
for file in MonitoredFiles file_name replace 1 W:\Dropbox\__atom__\project1\css\style.css (correct)
for file in MonitoredFiles file_name replace 2 W:\\Dropbox\\__atom__\\project1\\css\\style.css (double slashes)

The watchlist simply doesnt work.
The manual watch, only works if the watchlist is empty.
If watchlist is not empty, not even manual watch works.
After emptying watchlist, Atom must be reloaded, for manual watch to work.

Anything you want me to try here? is this useful to you?

@elistone
Copy link
Contributor

elistone commented May 19, 2016

@Jany-M Thank you very much! this is very useful, Im busy over the next few days but I can look at it more closely soon. Without checking I'm guessing the issue is to do with one of a few lines: 166-167

file_name = file.replace(/(['"])/g, "\\$1");
file_name = file.replace(/\\/g, '\\\\');

These lines try and escape the string e.g. escape quotes & quadruple slashes for windows to apply the styles but should not be passed to the monitored file function.

or 203

file = dirPath.split('\\').pop().split('/').pop()

This function I don't think is an issue just thought I put it out there this is meant to get the file name by popping everything after the last slash.

or 218

fullpath = projectPath + filesName.replace /^\s+|\s+$/g, ""

Could be this guy? This function gets the project path and filename and tries to build a url to the file for it to be monitored.

I think overall there should be a new function created to take care of parsing strings correctly, feel free to look into it, if not I shall try and do it sometime this weekend.

Thanks again for your help, its been great so far!

@Jany-M
Copy link
Contributor Author

Jany-M commented May 20, 2016

@elistone Great! Glad I could be of help.
I actually managed to fix it and send a pull request.

Now it works perfectly, little icon shows up next to the watched files in tree view, on Atom load, and file is uploaded automatically as expected (all paths are correct now) 👍

@elistone
Copy link
Contributor

@Jany-M great, shall look at in a bit & pull it, thanks again.

@Jany-M
Copy link
Contributor Author

Jany-M commented May 20, 2016

@elistone should we close this issue now or is there anything else to test out?

@elistone
Copy link
Contributor

@Jany-M It can be closed, I was just waiting till the patch was pushed.

@Jany-M
Copy link
Contributor Author

Jany-M commented May 23, 2016

@elistone once I updated the package with the latest release and bugfix, I still had to empty Atom's cache/storage in order for the auto-upload to work as expected. Just thought I'd let you know.

@Jany-M
Copy link
Contributor Author

Jany-M commented Jun 21, 2016

@elistone and it stopped working again :( paths seem right though, so Im not sure where to look now.
It might have stopped working after updating to Atom 1.8.0, but I can't be sure.
Is there any chance of a potential conflict with other packages? or is that not possible?
I don't see any errors in the console that could potentially affect this.

@enoversum
Copy link

@Jany-M It works beautifully with the latest beta on my computers 😉 . So at least it's not broken for everybody.

@elistone
Copy link
Contributor

elistone commented Jun 22, 2016

@Jany-M It seems to be broken on my work machine too, there have not been any updates to remote-sync so it is possible the latest version of Atom has broken it.

I have noticed if I put the file I wish to monitor in the watch automatically settings, it will not find the file then goes and monitors loads of random files... seems like this could be apart of the issue.

@elistone elistone reopened this Jun 22, 2016
@elistone elistone added this to the v4.2.0 milestone Jun 22, 2016
@elistone
Copy link
Contributor

@Jany-M I found the source of my issue, it was that my root folder had brackets in the name e.g. folder - details here (something) the ( ) around the something were creating some kind of error with the watcher chokidar maybe activating the globing or something.

Could you check if you have strange charters in any of the folders/files to the file you wish to monitor.

@Jany-M
Copy link
Contributor Author

Jany-M commented Jun 22, 2016

@elistone nope, nothing of the sort unfortunately. It doesnt work on all open projects I have (about 7 atm), and besides a few ones that have a _ in the folder name, the others are all one-word folder names. I dont have the issue with the random files though. It says it is monitoring all the right ones, but whether they're automatically watched or manually, they just don't upload.

I noticed that after removing the files from config manually (including the watch:[]), restarting, readding the files... it works again now.
I'll check with the other projects asap, but there's definitely something that needs to be adjusted... somewhere...?

@elistone
Copy link
Contributor

@Jany-M Sadly nothing I can really do to help in this case as we have not rolled out anything & seems to be local to your machine, you're welcome to look into it yourself.

@enoversum
Copy link

@Jany-M I had something similar with SASS files not being compiled in Sublime when any part of the folder structure had special characters in it. I remember it being ö, ä, ü as well as brackets of any sort, in my case [] . So it failed, even if it was something like this E:[Folder with brackets]\Projects\My Project . Maybe it is something like that?

@oueryemchi
Copy link

This is a real life struggle for me :( had Remote-FTP addon working, now busted after the update..tried many and this one seemed the best and now not watching my compiled css, guys is there is any real fix to this? thanks much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants