Wing Personal and Professional display an auto-completer in the editor and shells. When the completer appears, type until the correct symbol is highlighted in the list, or use the up/down arrow keys, and then press the Tab key or double click on an item. Wing will fill in the remaining characters for the source symbol, correcting any spelling errors you might have made in the name.
To alter which keys cause auto-completion to occur, use the Auto-completion Keys preference. Ctrl-click on the list to select multiple keys. For printable keys such as '.', '(', '[', and ':' the key will be added to the editor and any relevant auto-editing operations will be applied. For '.' the completer will be shown again for the attributes of the completed symbol.
To cancel out of the auto-completion popup, press the Esc key or Ctrl-G. The auto-completer will also disappear when you exit the source symbol (for example, by pushing space or any other character that isn't a completion key and can't be contained in a source symbol), if you click elsewhere on the surface of the source code, or if you issue other keyboard-bound commands that are not accepted by the auto-completer (for example, save through keyboard equivalent).
The completer can be configured to display immediately, only after a specified number of characters, or after a time delay. Completion may be case sensitive or insensitive and the completer may be auto-hidden after a specified timeout. These and other configuration options are in the Auto-completion preferences group.
The auto-completer contains two columns of icons that indicate the type and origin of the symbol. The first column may contain one of the following icons:
|A Python builtin|
|A snippet defined in the Snippets tool|
|An argument for the current function or method scope|
|The symbol was found by introspecting the live runtime state|
The second column of icons may contain one of the following icons:
|A Python keyword|
|A module name|
|A class name|
|A Python package (a directory with __init__.py in it)|
|A method name|
|A function name|
|An object instance (other than the basic types below)|
|A Python stack frame|
Additionally, icons in the second column may be annotated as in the following examples (the annotation may be applied to any of the above):
|An upward pointing arrow indicates that the symbol was inherited from a superclass|
|A leftward pointing arrow indicates that the symbol was imported with "from x import" style import statement|
Turbo Completion Mode for Python (Experimental)
When the Python Turbo Mode preference is enabled, Wing will use a different completion mode for Python files and in the shells. This treats any non-word key as being a completion key, in a context appropriate way. Ctrl, Alt, and Command act as cancel keys, in addition to Esc.
This mode can be considerably faster to use when the completer contains the desired text. Once the correct completion is selected in the completer, the next source code character can immediately be typed. The completion will be placed, the next key will be entered into the editor, any relevant auto-editing operations will be applied, and the completer shown again if appropriate.
In contexts where a new symbol is being defined, Wing disables Turbo mode depending on the character being pressed. For example, pressing = after a name at the start of a line, entering an argument name in a def, and entering a symbol after for all define a new symbol in most cases. In these contexts, Tab must be pressed to cause completion to occur.
The draw-back of operating in this mode is that Wing may fail to recognize some contexts where a new symbol is being defined, or may enter undesired completions when code is being typed before a referenced symbol has been defined. To make canceling from the completer more convenient in this case, Ctrl, Alt``, and Command are also treated as cancel keys, in addition to Esc.
For the same reason, snippets do not participate in Turbo mode. To enter snippets found in the auto-completer, press Tab.
This mode is experimental. Please email feedback and suggestions to email@example.com.
How Auto-completion Works
The information shown in Wing's auto-completer comes from several sources: (1) Static analysis of Python code, (2) introspection of extension module contents, (3) inspection of keywords and builtins in the active Python version, (4) introspection of the runtime application state when the debugger is active or when working in the shells, (5) enumeration of relevant code snippets, and in some cases (6) user-provided interface description files. See Source Code Analysis for more information on how static analysis works and how you can help Wing determine the types of values.
Because static analysis can be defeated by Python's dynamic nature, it is sometimes more effective to work from live runtime state. This can be done by placing a breakpoint in the source code, running to it, and then working in the editor or (in Wing IDE Pro) in the Debug Probe.
In non-Python files, the auto-completer is limited to words found within similar contexts in the file, keywords defined for syntax highlighting that file type, and any snippets relevant to the editing context.
|« 4.4. Transient, Sticky, and Locked Editors||Table of Contents||4.6. Source Assistant »|