adobe / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
33.25k stars 7.63k forks source link

Use a filewatcher library #12187

Closed ficristo closed 8 years ago

ficristo commented 8 years ago

Right now we use an outdated version of fsevents and fsevents_win to watch files. I think using a library better maintained would be a nice alternative option. I tried once to use chokidar but I've had some performance problem: maybe because it watches file recursively and Brackets doesn't. I don't know. Another library could be https://github.com/facebook/watchman/tree/master/node

ficristo commented 8 years ago

Or this https://github.com/amasad/sane that can use watchman under the hood but it's not necessary.

petetnt commented 8 years ago

Gaze is (yet another) option: https://github.com/shama/gaze (used by grunt-contrib-watch for example)

MiguelCastillo commented 8 years ago

I haven't done much research on this in a few months, but this https://github.com/paulmillr/chokidar was the better library I have seen around. It is used by watchify (browserify's watching plugin).

MiguelCastillo commented 8 years ago

@ficristo I have not noticed performance issues... But perhaps that's due to the fact that it is part of build process where it is really hard to see where performance is lost. How did you go about testing this performance issues you saw? Can you share you test setup so that I can run them? I am really curious :)

MiguelCastillo commented 8 years ago

@ficristo is the motivation purely about switching to a more actively maintained library? Curious to know if there are issues that you are trying to solve.

ficristo commented 8 years ago

No, there aren't specific problems. I only think using up to date library is (almost) always a plus.

MiguelCastillo commented 8 years ago

@ficristo sounds good to me. this will require quite a bit testing; you got different platforms that behave differently. If my memory serves me right, @peterflynn was one of the main dev involved in the current implementation. Perhaps he could chime in when he gets a sec.

You mentioned a really key point. chokidar will recursively add watchers and brackets does not. This is concerning. :)

Curious to know how does this works in Ubuntu... Have you tried it?

ficristo commented 8 years ago

No, I didn't. I'm not really Linux friendly...

MiguelCastillo commented 8 years ago

Let's continue further discussion in the actual PR https://github.com/adobe/brackets/pull/12190#issuecomment-183676768.

ficristo commented 8 years ago

Another couple of interesting libs. https://github.com/atom/node-pathwatcher https://github.com/bevry/watchr

ficristo commented 8 years ago

This PR https://github.com/adobe/brackets/pull/12647 is now using chokidar.

ficristo commented 8 years ago

Now that #12647 has merged we are using https://github.com/Microsoft/vscode-filewatcher-windows on Windows and https://github.com/paulmillr/chokidar on Linux and macOS.