facebookarchive / ide-flowtype

Flow support for Atom IDE
Other
178 stars 17 forks source link

Only run if .flowconfig present? (open to PRing!) #23

Closed markthethomas closed 7 years ago

markthethomas commented 7 years ago

Hey!

Love Flow and the ways the community is finding ways to tie it into Atom! I'd used Nuclide in the past but ended up moving away from it for various reasons, but was excited to try out the slightly-stripped down atom-ide! After installing that and then flow-ide and opening a non-flow project (i.e. lacking a .flowconfig), I got absolutely massive memory usage (~10-20GB). Figuring it was because it was including a huge node_modules folder and the lack of a .flowconfig wasn't telling flow not to parse those files.

That part makes good sense, but I'm wondering if there would be a way to enable "run if .flowconfig" functionality for this package like I've seen in other atom packages (some eslint ones specifically)? Reason I ask is because not all of my work projects are using flow and committing a .flowconfig to some repos isn't really an option. But if there's an option to only run if a .flowconfig exists, people in my situation (i.e.g not using/in all flow-based projects) would be able to take advantage of this project more easily 👍

Would be more than happy to PR and add the functionality in, but wanted to see if there was something I'm missing first 👍 thanks!

wbinnssmith commented 7 years ago

Hi @markthethomas! At the moment we actually don't spin up flow if you don't have a flow config present either in the mounted directory or any of its ancestors.

Can you confirm that it's flow that's consuming so much memory?Maybe you have a .flowconfig in your home directory or another ancestor of your project?

One thing we don't do is proactively shut down the server when we know we can't provide anything. Is there a way to let the client know about this @damieng?

Happy you're excited to contribute! We're always open to contributions. Keep in touch and let us know how your experience goes :)

markthethomas commented 7 years ago

Oh interesting! I wonder if it's the deeper flowconfig, I might have one of those floating around somewhere. It was definitely flow, can confirm via experience (only after install, fans kick in, everything crawls to stop, other apps suspended to preserve memory) and then via activity monitor. It would make sense that it would be overwhelmed if I have a flowconfig in my home dir, I'll check that out 👍 thanks for replying!

markthethomas commented 7 years ago

yep, that's the culprit! Thanks again @wbinnssmith! 👌

screen shot 2017-09-14 at 11 41 27 am screen shot 2017-09-14 at 11 41 52 am
wbinnssmith commented 7 years ago

Good to see this is resolved! I imagine this isn't an uncommon situation though, so we should probably figure a way of letting the user know.

Thing is, it's also not uncommon to mount a subdirectory of your flow root as a root within Atom, and users would probably expect flow to work in those situations :\