Always read files from disk for `File_provider` with local-memory backend
commitc5431ae4ba65a9a5c5d9292724ce21287d8d5a68
authorWaleed Khan <waleedk@fb.com>
Sat, 22 Jun 2019 02:24:24 +0000 (21 19:24 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Sat, 22 Jun 2019 02:31:18 +0000 (21 19:31 -0700)
tree5356bad801cb3eefe195b7ffbd2c4fdaa7a87251
parentd1c259d0be56a00db65757aadc6c5e5328dbd05e
Always read files from disk for `File_provider` with local-memory backend

Summary:
We should not cache every file we've ever read in memory in the serverless IDE, but rather only keep the files we need to in memory (those which are open in the editor). This commit turns off caching file contents in shared memory for the serverless IDE.

It should be noted that in the current incarnation of `hh_server`, we always reflect the state of the world, including the files changed in the editor. That is, if you make a change to `A.php` without saving, and you do autocomplete in `B.php`, it will really reflect the changes made in `A.php`, despite the fact that they have not been saved to disk.

This has the drawback that you can only have one state of the world at a time (for example, multiple clients cannot typecheck using different sets of unsaved files). This also includes the client which is `hh` on the command-line, which can lead to some confusing desynchronization issues.

For now, we won't reflect changes in any file except the one you're operating on, so changes to `A.php` won't affect autocomplete in `B.php` until `A.php` is saved. It is quite possible to load all the changes to decls in files open in the editor before doing any IDE operation, which would allow us to reflect changes in `A.php`, but without suffering desynchronization issues with `hh_server`.

Reviewed By: pittsw

Differential Revision: D15404423

fbshipit-source-id: 4a07c269a3227cbaeb71a5f63aa2fd473fbc361b
hphp/hack/src/providers/dune
hphp/hack/src/providers/file_provider.ml