Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Make file watching compatible with node version 6.x (runs on 0.10 too) #12647

Merged
merged 37 commits into from
Aug 25, 2016

Conversation

zaggino
Copy link
Contributor

@zaggino zaggino commented Aug 3, 2016

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)

@zaggino zaggino self-assigned this Aug 3, 2016
@zaggino zaggino force-pushed the shell-node6 branch 2 times, most recently from b38abeb to 2cd4cdc Compare August 4, 2016 04:59
@ingorichter
Copy link
Contributor

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.

@zaggino
Copy link
Contributor Author

zaggino commented Aug 4, 2016

Thanks @ingorichter , same thing happening on Windows, I'll be looking into it when I'll have some free time.

@zaggino
Copy link
Contributor Author

zaggino commented Aug 5, 2016

@ingorichter opening a different project/folder should be fixed now.

@zaggino
Copy link
Contributor Author

zaggino commented Aug 5, 2016

Good news, all my testing is passing and I can't see any more problems. Now the question: chokidar allows pushing ignore property to the library itself to ignore some entries, which is great.

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

@ingorichter
Copy link
Contributor

👏 @zaggino. That works way better now. Thanks for resolving this issue.
I like the idea of having everything filtered on the shell side. Perhaps we can have a feature flag to have both available. At least for some time before dropping the current implementation. It will be a great improvement over the existing implementation and should improve the performance (at least a bit). Perhaps we could even get rid of the TOO_MANY_FILES limitation.

@petetnt
Copy link
Collaborator

petetnt commented Aug 8, 2016

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 👍

@zaggino
Copy link
Contributor Author

zaggino commented Aug 16, 2016

@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.

@zaggino zaggino added this to the Release 1.8 milestone Aug 16, 2016
@zaggino zaggino removed their assignment Aug 16, 2016
@petetnt
Copy link
Collaborator

petetnt commented Aug 16, 2016

Great stuff @zaggino, I'll try this as an daily driver today and try to review the code side asap

@zaggino
Copy link
Contributor Author

zaggino commented Aug 18, 2016

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.

@ingorichter
Copy link
Contributor

Okay, I'm testing it now and report back when I see things behaving weird.

@ficristo
Copy link
Collaborator

Excluding node_modules

I really hope we'll make these user configurable (followup is fine). I think, for example, we should ignore bower_components by default too.

@zaggino
Copy link
Contributor Author

zaggino commented Aug 18, 2016

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"
Copy link
Collaborator

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?

Copy link
Collaborator

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 🐱

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Contributor Author

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

@zaggino
Copy link
Contributor Author

zaggino commented Aug 24, 2016

@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).

@zaggino zaggino mentioned this pull request Aug 24, 2016
@ficristo ficristo merged commit be62881 into master Aug 25, 2016
@ficristo ficristo deleted the shell-node6 branch August 25, 2016 05:38
@ficristo
Copy link
Collaborator

I think we had iterate on this PR enough for merging.
@petetnt @ingorichter if you have found any issues we can look in a followup.

@zaggino amazing work. Thank you.

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

Successfully merging this pull request may close these issues.

4 participants