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

Wing Pro provides some optional auto-editing features, where the IDE tries to reduce typing by auto-entering expected text. The following operations are available:

  • Auto-Close Characters -- Wing enters matching quotes, parentheses, brackets, braces, and comment closing characters. When this is enabled Wing skips over existing closing characters if they are typed anyway. Wing also auto-enters opening parentheses, brackets, and braces when an unmatched closing character is typed in Python code. This operation is disabled selectively when working within strings, comments, and in other contexts where the auto-edit is more likely to interfere than assist with editing. For example, quotes are not auto-closed within strings, most auto-closing is disabled within single-quoted strings, auto-closing is disabled if there is a matching unclosed character, auto-closing parentheses is disabled before a symbol, and some operations are omitted while auto-entering invocation arguments.
  • Auto-Enter Invocation Args -- Wing enters the default arguments for a function or method invocation. The tab key or ',' can be used to move among the arguments. Argument entry ends when moving past the last argument, or pressing ')' at the last argument. Unaltered default arguments are automatically removed when argument entry ends.
  • Apply Quotes to Selection -- Wing will surround a non-empty selection with quotes when the quote character is typed. In Python code, this will also convert the type of quote used in a string (either single quote or double quote) if the string is selected, or the caret is in the triple quote area, or one or more of the enclosing quotes is selected.
  • Apply Comment Key to Selection -- For single-character comment keys, Wing will comment out or uncomment out the currently selected lines, using the configured Block Comment Style.
  • Apply (), [], and {} to Selection -- When an open parenthesis, bracket, or brace is typed over a non-empty selection, Wing surrounds the selection with the matching characters.
  • Apply Colon to Selection -- When one or more lines are selected, Wing creates a new block using those lines and places the caret for immediate entry of the block type (if, try, for, with, etc). When try is subsequently entered, Wing auto-enters the matching except block. In this case, except is selected so it can be changed into finally. Pressing the Tab key moves into the except or finally block.
  • Auto-Enter Spaces -- In Python code, Wing auto-enters spaces when typing operators or punctuation. Some associated characters may also be entered, such as ',' after a dict item when ':' is pressed. When this operation is enabled, Wing also refuses to enter redundant spaces or commas in contexts where spacing is being enforced. In non-Python files this operation only enters spaces after a comma. Note that for some operations such as typing "==" spacing will be adjusted differently after the first and second keys are pressed. When this is enabled, the following sub-operations are available:

    • Auto-Space After Keywords -- In Python code, Wing also auto-enters spaces after keyword names. No space is added when the keyword name matches a snippet in the auto-completer, so that snippets can still be used.
    • Enforce PEP8 Style Spacing -- Wing will enforce PEP8 style spacing as you type each character. See PEP8 Auto-formatting for other PEP8 auto-formatting options.
    • Spaces Around : in Type Annotations -- Wing will auto-enter spaces around ":" when it is used in PEP 484 and PEP 526 type hints.
  • Manage Blocks on Repeated Colon Presses -- In Python code, Wing auto-indents the current line, enters the EOL character(s), and auto-indents the new line after a new block start is typed and ":" is pressed. In order to allow for adjustment of indentation before continuing, no EOL will be inserted after 'else', 'elif', 'except', and 'finally' if the indentation position for that statement is ambigious due to the presence of multiple potentially matching starting blocks. In that case, pressing ':' repeatedly will toggle the indentation between the possible positions. When this option is enabled and a new line was entered, pressing ":" a second time will remove the new line and indent the following line of code under the new block. Pressing ":" a third time will indent the next contiguous block of lines, up to any blank line or line that belongs to an enclosing block.
  • Continue Comment or String on New Line -- Wing auto-enters comment or string delimiters when Enter is pressed within the text of an existing comment or a string in the form ("") or ('').
  • Correct Out-of-Order Typing -- Wing corrects common typos in a way that can reduce typing. For example, x(.) is replaced with x()., x(:) is replaced with x():, and Wing will add . when it is missing in x().d.

Each of these operations can be enabled or disabled independently in the Auto-Editing preferences group.

Where relevant (such as in spacing) Wing's auto-editing modes adhere to the PEP8 Style Guide for Python Code.