<type>documentation</type>
<domain>edit</domain>
<id>auto-completion</id>
<title>Auto-completion</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>all</product>

Wing provides context-appropriate code completion in the
~~~if WINGPRO:
editor, `Python Shell <ref:debug/python-shell>`__ and `Debug Console
<ref:debug/debug-console>`__.
~~~
~~~if not WINGPRO:
editor and , `Python Shell <ref:debug/python-shell>`__.
~~~
Using the auto-completer decreases the amount of typing needed to write code, and reduces the 
incidence of typos in symbol names.
~~~if WING101 or WEBSITE:
In Wing 101, this feature is disabled by default.
~~~

When enabled with the `Editor > Auto-completion > Auto-show Completer 
<script:show_preferences_gui#prefname="edit.autocomplete-autoshow-option">`__ 
preference, the auto-completer appears and disappears automatically as you type.  
Items can be selected by typing until the correct symbol is highlighted, or
by using the up and down arrow keys.

To cancel out of the auto-completer, press ``Esc`` or ``Ctrl-G``. The auto-completer also
disappears when you exit the source symbol by typing or clicking elsewhere, or if you
press key bindings to invoke other commands.

**Completion Keys**

By default, ``Tab`` enters the completion it into the editor.  Other completion
keys can be added with the `Editor > Auto-completion >
Completion Keys <script:show_preferences_gui#prefname="edit.autocomplete-keys">`__
preference.  For printable keys such as ``'.'``, ``'('``, ``'['``, and ``':'`` the completion
character will be added to the editor after the completed symbol, and any appropriate
`auto-editing <ref:edit/auto-editing>`__ operations will be applied. If ``'.'`` is used as a
completion key, the auto-completer will reappear immediately with the attributes of the
completed symbol.

~~~if WINGPRO:
In Wing Pro, it is also possible to configure the auto-completer in Python code
to treat any non-symbol key as a completion key.  See `Turbo Completion Mode for Python 
<ref:edit/turbo-completion>`__ for details.
~~~

~~~if not WING101:
**Configuration**

In Wing Pro and Wing Personal, the completer can be reconfigured to display only after a
specified number of characters, or after a time delay. Completion matching may be case
sensitive or insensitive. The completer may also be resized, and can be auto-hidden after
a specified timeout.

These and other configuration options are available in the `Auto-completion preferences
<script:show_preferences_gui#prefname="edit.autocomplete-autoshow-option">`__.
~~~

~~~if WINGPRO:
**Code Snippets**

In Wing Pro, the auto-completer also contains the names of snippets defined in the
`Snippets <script:show-panel-snippets>`__ tool. Completing a snippet enters it into the
editor and collect any snippet arguments inline in the editor, in fields that can be
traversed with the ``Tab`` key. For details, see `Snippets <ref:edit/snippets>`__.

To prevent Wing from including snippets in the auto-completer, turn off the 
`Editor > Auto-completion > Include Snippets in Completer 
<script:show_preferences_gui#prefname="edit.snippets-in-autocompleter">`__ preference.
~~~

