Turbo Completion Mode for Python

Index of All Documentation » Wing Pro Reference Manual » Source Code Editor » Auto-completion »

In Wing Pro, when the Editor > Auto-completion > Python Turbo Mode preference is enabled, Wing uses a different completion mode for Python files, and in the Python Shell and Debug Console. This mode treats any key that could not be part of a symbol name as a completion key, in a context-appropriate way.

This allows typing until the correct symbol is selected in the completer and then immediately moving on to typing the code that should follow that symbol. For example, typing + will place the completion, enter + into the editor, apply any relevant auto-editing operations (such as auto-spacing), and show the completer 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.

Although this mode offers a much more efficient way to type Python code, it takes some getting used to before unwanted completions can be avoided. Specifically:

  • If you are trying to type a symbol name before it has been defined, Wing may choose a similarly named symbol from the completer if you do not first cancel out of the completer. As a result, it's usually easier to define symbols first, before writing other code that uses them.
  • Similarly, Wing may fail to recognize some contexts as defining a new symbol. To avoid completing a similarly named symbol, you must first cancel out of the completer.

To make canceling from the completer easier in these cases, Ctrl, Alt, and Command pressed alone are also treated as cancel keys, in addition to Esc.

For the same reason, snippets and auto-imports do not participate in Turbo mode completion. To enter those from the auto-completer, press Tab.