always use textEdits for autocomplete
Summary:
LSP recommends to use text-edits for autocomplete
```
* The `insertText` is subject to interpretation by the client side.
* Some tools might not take the string literally. For example
* VS Code when code complete is requested in this example
* `con<cursor position>` and a completion item with an `insertText` of
* `console` is provided it will only insert `sole`. Therefore it is
* recommended to use `textEdit` instead since it avoids additional client
* side interpretation.
```
Prior to this diff, Hack would default to using insertText unless it had been sent the initializationOption "useTextEditAutocomplete" in which case it would use the (better) TextEdit.
After this diff, it will now always use TextEdit.
We know that VSCode supports TextEdit autocomplete: https://github.com/microsoft/language-server-protocol/issues/264#issuecomment-
346864271
Does emacs support TextEdit autocomplete? It looks like it: https://github.com/emacs-lsp/lsp-mode/blob/
ea6f2f8d0beaa713feaed1688ea0610392199eda/lsp-completion.el#L554-L572
Does Vim support TextEdit autocomplete? I don't know...
Does Atom support TextEdit autocomplete? It didn't three years ago, but I don't know the status now.
Note: the code still uses insertText for snippets, like it always did. I can't remember the reason for this. Is it because Nuclide didn't support insertText for snippets? Is it because we just didn't get around to it? I can't remember. Anyway, I left it as is.
Reviewed By: Wilfred
Differential Revision:
D34911115
fbshipit-source-id:
42f78f50800493725014746871620470bec5bd16