for Windows and Linux
Use this page to configure formatting options for XML files. View the result in the Preview pane on the right.
On this page:
Tabs and Indents
|Use tab character|| |
- If this check box is selected, tab characters are used:
- On pressing the Tab key
- For indentation
- For code reformatting
- When the check box is cleared, DataGrip uses spaces instead of tabs.
|Smart tabs|| |
- If this check box is selected, the part of indentation defined by the nesting of code blocks, is made of the tabs and (if necessary) spaces, while the part of indentation defined by the alignment is made only of spaces.
- If this check box is cleared, only tabs are used. This means that a group of spaces that fits the specified tab size is automatically replaced with a tab, which may result in breaking fine alignment.
The Smart Tabs 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 between the elements of an array, in expressions, method declarations and method calls.|
|Keep indents on empty lines||If this check box is selected, then DataGrip will keep indents on the empty lines as if they contained some code.|
If this check box is not selected, DataGrip will delete the tab characters and spaces.
|Right Margin||Use these settings to specify a margin space required on the right side of an element. If you select Default option then a value of the right margin from the global settings will be used.|
|Wrap on typing||Use these settings settings to specify how the edited text is fitted in the specified Right margin. You can select one the following options: |
- Default - in this case DataGrip uses the Wrap on typing option that is specified in the global settings.
- Yes - in this case the value in the specified right margin is used.
- No - in this case this option is switched off and a line can exceed the number that is specified in the right margin.
|Keep line breaks||Select this check box to have DataGrip honor line breaks when reviewing XML files in the editor.|
|Keep line breaks in text||Select this check box to have DataGrip 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
- Keep whitespaces inside: If this check box is selected, whitespaces will be preserved after
CDATA[ and before
This tab lets you define a set of rules that rearranges your code according to your preferences.
|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.
Note that clicking twice on the type keyword will negate the condition.
- 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.
- Namespace - use this field to specify the namespace in the rule. It lets you specify a rule that controls a namespace attribute position.
- Order - use this drop-down list 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.
- Aliases - this option displays aliases that were defined in the Rules Alias Definition dialog. You can remove the ones you do not need.
| ||This icon appears when you select Order by Name in Order option. The icon indicates that the items in this rule are alphabetized.|
|Additional Settings||Use this area to set additional arrangement options. The Force rearrange drop-down list lets you select options that affect the Rearrange entries check box in the Reformat Code dialog.|
You can select from the following options:
- Use current mode (toggled in the Reformat Code dialog) - In this case the Rearrange entries check box stays active and you can modify it in the Reformat Code dialog.
- Always - In this case the Rearrange entries check box is selected and becomes read-only.
- Never - In this case the Rearrange entries check box is cleared and becomes read-only.
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.
Last modified: 27 July 2017