-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flow][autocomplete] cache artifacts in autocomplete session
Summary: This diff applies caching of type artifacts for LSP requests in an autocomplete session. For example in the session below we expect to see the following hits/misses: ``` foo.| // cache miss foo.b| // cache hit foo.ba| // cache hit foo.bar| // cache hit ``` This is done similar to how other LSP commands do it, but with a few key differences: * The cached artifacts are adapted to the needs of autocomplete. We store a different map in the persistent client, with the following contents: - We use `Typed_ast_utils.available_ast` (which is an option between typed AST and type env), instead of only typed AST, since autocomplete does not need to compute the entire typed AST (under on-demand mode). - We cache the canonical contents for the autocomplete session, so that we can compare them with the next AC request we get. * Eviction differs in that we don't remove artifacts on `didChange`. It is expected that contents will change during an AC session, but canonical contents will not. * A cache hit is when canonical contents of cached version match current contents. (Adjusted `with_cache_sync` slightly to support this.) * On a cache miss we still do autocomplete's special type inference (D55080918) Changelog: [internal] Reviewed By: SamChou19815 Differential Revision: D55456832 fbshipit-source-id: 3deb952807f6c1d463aef81883d9e4346864894f
- Loading branch information
1 parent
581f9cf
commit f548c45
Showing
6 changed files
with
76 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters