How Indent Style is Determined

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


Wing can work with files with different indentation styles, including tab-only, space-only, and tab+space indentation.

When an existing file is opened, it is scanned to determine what type of indentation is used in that file. Wing then matches new indentation added during editing to the form already found in the file. If mixed forms of indentation are found, the most common form is used. If no indentation is found, Wing uses the Preferred Indent Style set in Project Properties, or the Editor > Indentation > Default Indent Style and Editor > Indentation > Default Indent Size preferences.

Changing Indent Style

To change the indentation style in an existing file, use Indentation in the Tools menu.

You can use a different indentation style for non-Python files without first converting existing indent styles by changing the Indent Style property in File Properties, which is accessed by right-clicking on the editor. Wing will warn that you are entering inconsistent styles of indentation, but the warning can be disabled from the warning dialog or from the Editor > Indentation > Show Override Warning Dialog preference.

For Python files, where indentation has syntactic significance, the Indent Style cannot be altered without converting the whole file using the Indentation tool, which is accessed from the button next to the Indent Style property in File Properties or from the Tools menu.

Tab Size

The size of the tab character is controlled with the Editor > Indentation > Default Tab Size preference. This defines the position of tab stops, counting in multiples of tab size from the start of the line.

This preference is ignored in Python files with mixed tab and space indents, where the file is always shown in the way that the Python interpreter would see it.

Disabling Indent Analysis

Although not recommented, it is possible to disable any attempt to use file contents to determine the style of indentation to use while editing. This is done with the Editor > Indentation > Use Indent Analysis preference. When this is disabled, Wing always uses the Preferred Indent Style set in Project Properties, or the Editor > Indentation > Default Indent Style and Editor > Indentation > Default Indent Size preferences.