Tabs and Indents
| Item | Description |
|---|
| Use tab character | If this check box is selected, tab characters are used:
- On pressing the TabTab key
- For indentation
- For code reformatting
Otherwise, spaces are used instead of tabs.
|
| Smart tabs | If this check box is selected, PyCharm inserts tabs for indentation and reformatting,
but fine alignment to a necessary column is done
only
via spaces. This is done in order to preserve visual
representation of the source code, when the
Tab Size
is changed.
If this check box is not selected, then spaces are used for alignment if necessary.
This check box is available if the
Use Tab Character
check box is selected.
|
| Tab size | In this text box, specify the number of spaces included in a tab. |
| Indent | In this text box, specify the number of spaces (or tabs if the
Use Tab Character
check box is selected) to be inserted for each indent level.
|
| Continuation indent | In this text box, specify the number of spaces (or tabs if the
Use Tab Character
check box is selected)
to be inserted at the next line in case of a construct break.
|
Other
| Item | Description |
|---|
| Keep line breaks | Select this check box to have PyCharm honor line breaks when reviewing XML files in the editor. |
| Keep line breaks in text | Select this check box to have PyCharm honor line breaks in attributes (for example, lengthy descriptions) when
reviewing XML files in the editor.
|
| Keep blank lines | In this text box, specify the minimum number of sequential blank lines to be retained after reformatting. |
| Wrap attributes | Use this drop-down list to determine how attribute lines should be wrapped. The available options are:
- Do not wrap -
if this option is selected, no special wrapping style is applied to the code.
- Wrap if long -
select this option to have lines going beyond the right margin wrapped with proper indentation.
- Chop down if long -
select this option to have elements in lists that go beyond the right margin wrapped
to give one element per line with proper indentation.
- Wrap always -
select this option to have all elements in lists wrapped to give one element per line with proper indentation.
|
| Wrap text | Select this check box to have long lines wrapped according to the code style settings. |
| Align attributes | Select this check box to have attributes in sequential lines aligned. |
| Keep white spaces | When this check box is selected, the editor preserves all whitespaces within tags. The same refers also to the indents, and line breaks. |
| Spaces | In this area, define the usage of spaces for attributes and tag names.
- Around "=" in attribute:
select this check box to have spaces added around the "=" symbol in attributes.
- After tag name:
select this check box to have spaces added after tag names.
- In empty tag:
select this check box to have spaces added in empty tags.
|
| CDATA | In this area, define the usage of whitespaces around and inside CDATA sections in MXML files:
- Whitespaces around: from the drop-down list, choose how whitespaces around CDATA will be treated.
- Preserve: all whitespaces will be left intact after reformatting.
- Remove (keep with tags): all whitespaces around CDATA will be removed,
and tags will be kept on the same lines.
- New lines: new lines will be added before and after CDATA.
- Keep whitespaces inside: If this check box is selected, whitespaces will be preserved after
CDATA[ and before ]].
|
Arrangement
This tab lets you define a set of rules that rearranges your code according to your preferences.
| Item | Description |
|---|
| Grouping Rules | Use this area to set the grouping rules.
|
| Matching rules | Use this area to define elements order as a list of rules, where every rule has a set of matches such as
modifier or type.
- use this button to add a rule. The empty rule dialog window opens. - use this button to remove the rule from the list. - use this button to edit an existing rule. To see this button, navigate to the rule that
you want to edit and click on the button. In pop-up window that opens, modify the rule fields. - use these buttons to move the selected rule up or down.
|
| Empty rule | Use this window to create a new matching rule or edit an existing one.
You can select from the following filters:
- Type - use this filter to choose classes or methods for your rule.
- Name - use this field to specify entry names in the rule. This filter matches only entry names
such as field names, method names, class names and etc. The filter supports regular expressions and uses a standard syntax
. The match is performed
against the entire name. - Order - use this option to select the sorting order for the rule. This option is useful when
more than one element uses the same matching rule. In this case, selecting Keep order will keep the same order as was set before the rearrangement and
selecting Order by Name will sort the elements with the same matching rule by their names.
|
 | This icon appears when you select Order by Name in Order option. The icon indicates that the items in this rule are alphabetized. |
Android
| Item | Description |
|---|
| Use custom formatting settings for Android XML files | Use this check box to set a custom formatting for the Android XML files. This might be helpful if you need to format
Android files differently from other XML files or need to use specific Android formatting options.
If this check box is not selected, the default XML files formatting is applied.
|
| AndroidManifest.xml | Use this area to set the following formatting for AndroidManifest.xml:
- Wrap attributes - use this drop-down list to determine how attribute lines should be wrapped.
See the available options.
- Insert line break before first attribute - select this check box to insert a line before the first attribute.
- Group tags with the same name - select this check box to group tags with the same name.
|
| Layout Files | Use this area to set the following formatting for the layout files:
- Wrap attributes - use this drop-down list to determine how the attribute lines should be wrapped.
See the available options.
- Insert line break before first attribute - select this check box to insert a line break before the first attribute.
- Insert blank line before tag - select this check box to insert a blank line before the tag.
|
| Value Resources Files and Selectors | Use this area to set the following formatting for value resource files and selectors:
- Wrap attributes - use this drop-down list to determine how attribute lines should be wrapped.
See the available options.
- Insert line breaks around style declaration - select this check box to insert line breaks around a style declaration.
|
| Other XML resource files | Use this area to set Wrap attributes for other XML resource files. See the
available options. |
Set From
Click this link to reveal the list of languages to be used as the base for the current language code style. So doing,
only the settings that are applicable to the current language are taken. All the other settings are not affected.
This link appears in the upper-right corner of the language-specific code style page, when applicable.
Click Reset to discard changes and return to the initial set of code style settings.