-
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] introduce canonical form of contents
Summary: An autocomplete session is a series of requests on the same token. E.g. ``` foo.| foo.b| foo.ba| foo.bar| ``` Motivation for this change is to enable caching of typing artifacts within an autocomplete session. To enable this caching this diff introduces a canonical form that can be used as a representative for all versions of contents during an autocomplete session. The canonical form for all versions of contents in the above example is `foo.AUTO332`. Notice that we have removed the prefix `bar` before adding the sigil. The key idea behind this concept is that the type inference process (which happens today) is identical for all of the forms: ``` foo.AUTO332 foo.bAUTO332 foo.baAUTO332 foo.barAUTO332 ``` Having a single form to represent all these forms makes caching of typing artifacts for autocomplete practical. The main parts of the implementation for this idea are: 1. Add `Autocomplete_sig.add_canonical` that returns the canonical form of the contents, and, if successful, information about the prefix and suffix of the identifier around the cursor. 2. Parse and type check the canonical form. 3. Recover the location and token under cursor for further processing in autocompleteService_js.ml. For example, convert `"AUTO332"` to `"fooAUTO332bar"`, since this is the expected form. Changelog: [internal] Reviewed By: SamChou19815 Differential Revision: D55273266 fbshipit-source-id: f7c99762d959509950fa0bd80199f9da91ec33a6
- Loading branch information
1 parent
5563901
commit 581f9cf
Showing
12 changed files
with
231 additions
and
12 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
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
Oops, something went wrong.