Add autocomplete complete support for enum atoms
commit6eca31d3aea42db7cacf7d62779539088df57126
authorVassil Mladenov <vmladenov@fb.com>
Mon, 22 Mar 2021 18:45:08 +0000 (22 11:45 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 22 Mar 2021 18:49:40 +0000 (22 11:49 -0700)
treea8b224617088c0e2fb4093a15aa072a6fdcd4180
parent5b8c71a85f1efa0a9090b93932b337c050ac26eb
Add autocomplete complete support for enum atoms

Summary:
Given
```
function f<T>(<<__Atom>> HH\MemberOf<EE, T> $m): void {}
```

This is meant trigger autocomplete on `f#` with nearly the same results as `EE::`. I just send back the constants of the enum class, ignoring the `::class` constant which is used for classname (not relevant to atoms).

The enum atom rewriting works out nicely, because when we see `f#AUTO332` the parser guarantees that we're in an `Aast.Call` node, so I can just look at `Call` nodes where the first argument is an `EnumAtom`.

Reviewed By: Wilfred

Differential Revision: D27145618

fbshipit-source-id: f7a68638c98e250f232eb804233407030d31c7b5
16 files changed:
hphp/hack/src/client/clientLsp.ml
hphp/hack/src/server/autocompleteService.ml
hphp/hack/test/autocomplete/enum_atom/HH_FLAGS [new file with mode: 0644]
hphp/hack/test/autocomplete/enum_atom/enum_atom_fun.php [new file with mode: 0644]
hphp/hack/test/autocomplete/enum_atom/enum_atom_fun.php.exp [new file with mode: 0644]
hphp/hack/test/autocomplete/enum_atom/enum_atom_fun_generic.php [new file with mode: 0644]
hphp/hack/test/autocomplete/enum_atom/enum_atom_fun_generic.php.exp [new file with mode: 0644]
hphp/hack/test/integration/data/lsp_exchanges/.hhconfig
hphp/hack/test/integration/data/lsp_exchanges/completion.php
hphp/hack/test/integration/data/lsp_exchanges/definition.php
hphp/hack/test/integration/data/lsp_exchanges/hover.php
hphp/hack/test/integration/data/lsp_exchanges/initialize_shutdown.expected
hphp/hack/test/integration/data/lsp_exchanges/nomethod.expected
hphp/hack/test/integration/data/lsp_exchanges/references.expected
hphp/hack/test/integration/data/lsp_exchanges/rename.expected
hphp/hack/test/integration/test_lsp.py