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)
|{F30299074}|{F30299140}
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:
{F30299081}
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
=== Open questions
- [ ] **1.** What are the different ways the in-surface picker can be initiated (typing `@`, clicking the "馃懁" in the `Visual` mode's toolbar, etc.)
- [ ] **2.** What should the username picker look like? How should it be have (e.g. how should results be populated?)?
- [x] **3.** What is going to be inserted into the page once a user is "picked" (e.g. a template //like// `{{FlowMention:NAME|NAME}}`, link to their user page `[[User:NAME|NAME]]` )
-- Per T232601#5960614, currently a link to the person being mentioned's user page is inserted. In the future, we will consider enabling wikis to customize this behavior. That work would happen in: T250332.
- [ ] When {key @} is typed, should the username completion list show the username of people who have commented in other sections on the page? //In this scenario, the usernames that appear in the username completion list is limited to people who have commented in the section within which the username completion list is being invoked.//