-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Make file watching compatible with node version 6.x (runs on 0.10 too) #12647
Conversation
b38abeb
to
2cd4cdc
Compare
Okay, I'm able to build on OSX. Brackets launches and changes in the opened folder will show up in the project tree. Adding a file in the finder will update the project tree. The same applies for deleting a file. The whole thing stops working, the moment I open a different folder/project. From that point on I don't receive any change notifications anymore and I'm unable to open a different folder/project. |
Thanks @ingorichter , same thing happening on Windows, I'll be looking into it when I'll have some free time. |
@ingorichter opening a different project/folder should be fixed now. |
Good news, all my testing is passing and I can't see any more problems. Now the question: The way it currently works: brackets-web get all file change notifications (even from .git folders, and that's a heap of notifications) from brackets-shell and these are filtered on the web side. The way it could work: brackets-web could pass filter to the brackes-shell to use with chokidar and these would be filtered on shell side which would be great (much less change events and load on the domain connection) but it would also mean that the api between web and shell would have to change. This would be concern for other brackets-web implementations which doesn't use brackets-shell. Question is: make this breaking change in this PR or not? @ingorichter @ficristo @petetnt @busykai @abose @marcelgerber |
👏 @zaggino. That works way better now. Thanks for resolving this issue. |
I am with @ingorichter with having it behind a feature flag but enabled by default. It brings huge benefits for Brackets. Great job with this PR and the current progress with the Node update too in general, really excited about this one 👍 |
@ingorichter @petetnt implemented & tested I've actually been using this branch and related shell build daily for a few days now "in production" and I haven't encountered any side effects. Considering this finished, now it needs a review and hopefully a merge soon. |
Great stuff @zaggino, I'll try this as an daily driver today and try to review the code side asap |
Excluding node_modules too, watching over them with chokidar causes problems for npm installations and updates to run in a project folder (ref npm/npm#10826 (comment)). It'd be highly unusual workflow working inside a node_modules folder anyway. |
Okay, I'm testing it now and report back when I see things behaving weird. |
I really hope we'll make these user configurable (followup is fine). I think, for example, we should ignore |
Followup is fine, I prefer not to build more features until this is merged. |
@@ -99,7 +99,8 @@ function watchPath(path, ignored) { | |||
ignoreInitial: true, | |||
ignorePermissionErrors: true, | |||
followSymlinks: true, | |||
ignored: ignored | |||
ignored: ignored, | |||
usePolling: process.platform === "win32" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is sad, @zaggino why you need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no fsevents
on Windows so polling is required, right? That is unless we continue to use fsevents-win
🐱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sadly, chokidar
causes watched files to lock-up, can't use npm install
or bower install
over a watched directory, will need to investigate more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just saw there were already some issues filed against chokidar and the solution seems to use the usepolling
option 😞
It seems to me that even VSCode uses its own watcher system on Windows: https://github.com/Microsoft/vscode-filewatcher-windows
By the way on unix they seems to use these options: https://github.com/Microsoft/vscode/blob/0d658f2c0308c770b90df5a73816f0c045817689/src/vs/workbench/services/files/node/watcher/unix/chokidarWatcherService.ts#L30
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @ficristo , good pointers, I'll update this PR soon
usePolling on windows
add note to a FileSystemStats constructor
forgotten arg name in jsdoc jsdoc comment do a bit of renaming remove unnecessary export refactor FileWatcherDomain
reverted node in travis update coment forgotten export
refactor, fix stats bug
…rite notifications
fix jsdoc rename fwm to FileWatcherManager remove tabs update comment add missed param to jsdoc
@ficristo this should be ready for merging now. I've squashed commits that didn't have much of a meaning on their own like "refactor" or "add comment". Grunt script for installing production node_modules into a dist folder is also present (and tested). |
I think we had iterate on this PR enough for merging. @zaggino amazing work. Thank you. |
related to adobe/brackets-shell#543
trying to make brackets work with the new version of node in the shell
cc @ficristo (I couldn't commit to your repo that's why I merged your branch here)