Pass FindRefs requests from IDE process to typechecker process
commit79df3b9ce5decb506aa6dbe185b62e0e32753a10
authorKasper Kopec <kasper@fb.com>
Sat, 5 Mar 2016 07:12:41 +0000 (4 23:12 -0800)
committerHhvm Bot <hhvm-bot-bot@fb.com>
Mon, 7 Mar 2016 18:34:34 +0000 (7 10:34 -0800)
tree136e13e54d64b1b09c791fb2ec2ccb52d847c3df
parente5278dc141084888f2805839919857072172f9f7
Pass FindRefs requests from IDE process to typechecker process

Summary:FindReferences works by:

 - looking at given symbol dependency table entry for files that might have anything to do with it
 - setting appropriate hooks and typechecking all those files, recording when actual references occur

"Typechecking all those files" is an action that needs to be parallelized, but IDE process doesn't have any workers that could do it. Spawning a separate pool of workers for IDE process is an option, but I'm not sure if it's worth it (resource-wise), when they will be sitting idle 99% of time.

Moreover, even with parallelization, getting the results for some popular symbols can take 10+ seconds, so such pool would also not be operated by IDE process which should not block, but a separate process dedicated to it, which is a level of complexity not worth it now. We'll just send the request to master process to be executed when free.

Nuclide is aware of this operation taking long, so when you do find references it shows a popup message in the corner letting users know that information is being fetched now and it will take some time. It works pretty well at calming your nerves, and we want to have similar status message for when server is not ready, instead of stuff simply not working.

Reviewed By: int3

Differential Revision: D3004827

fb-gh-sync-id: 8575749ff3c7fd665a3cdf5137dc377b82230220
shipit-source-id: 8575749ff3c7fd665a3cdf5137dc377b82230220
hphp/hack/src/server/ideJson.ml
hphp/hack/src/server/ideMain.ml
hphp/hack/src/server/ideProcessMessage.ml
hphp/hack/src/server/ideServerCall.ml
hphp/hack/src/server/ideServerCall.mli
hphp/hack/src/server/serverMain.ml