Currently there is no way to provide autocomplete suggestions while the user is typing directly in the document. This technique is commonly used for '@' mentions:
|Phabricator (desktop)||Twitter (mobile)|
The lack of this feature has led to a workaround in Flow which uses an inspector triggered by an '@' sequence, but this results in a clunky user experience, and bugs such as T147408:
Some initial requirements for an autocomplete module
- Define a sequence for launching, probably re-use the ve.ui.Sequence system, which allows for generic regex matching
- The process is aborted if:
- Escape is pressed
- Some other configurable sequence is typed, e.g. a space immediately after '@'
- If the process is aborted, the text typed so far should be left as is.
- The process is successful if:
- A result is selected using arrow keys + enter, or mouse click
- An exact match is typed e.g. @exactusername<space> (this could be optional)
- If the process is successful, then a replacement can take place, e.g. format the text with a link/other annotation, or replace with a template