Gadgets/autocomplete

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search
Screenshot of autocomplete gadget
  • Summary: A context aware autocomplete that suggest links when user typing [[, and template when user type {{. The gadget takes advantage of TemplateData, and can also help to fill parameters names.

More general info about Gadgets

Setup[edit]

To setup the gadget in new project:

  1. Add the source code

FAQ[edit]

Links[edit]

  • The gadget use the same mechanism as the suggestion in the searchbox, only pages that appear in the search will be suggested.
  • The gadget suggest links when user start to type [[ and typed at least the beginning of the pagename.
  • The gadget suggest links also when a template parameter is filled is expecting page name based on template data (see #Templatedata)
  • The gadget supports links to sections (such as Wikipedia:Featured articles#Biology when user type [[Wikipedia:Featured articles#). By design this is supported only when editing pages not in main space.

Templates[edit]

Autocomplete gadget can fill template names (cursor is near {{user he))
  • Similarly to links, the gadget suggest template names when user start to type {{

Templatedata[edit]

Autocompelte gadget can fill parameters names (when the cursor is near "ima" parameter)
  • The gadget complete parameter names when user is within a template and typed | if the template has templatedata.
  • For templates expecting unnamed parameters, the gadget expect the user to first fill the unnamed parameters and doesn't suggest parameter name. For example
    • Template source: the user page is [[User:{{{1|{{{Username}}}}}}]]
    • when user typed {{template|User<span style=" it isn't possible to know whether the user typed a name of a user starting with "User" or started to type the parameter name "Username". The gadget assume the first option.
    • For parameters indicated as referring to other pages, the gadget suggest filling similar to links and templates. Supported parameters types:
    • wiki-page-name
    • wiki-file-name
    • wiki-user-name

Keyboard shortcuts[edit]

  • ESC - close the suggestions
  • arrow keys - move between different suggestions.