IntelliJ IDEA 2020.2 Help

Code Style: Vue

File | Settings | Editor | Code Style | Vue for Windows and Linux

IntelliJ IDEA | Preferences | Editor | Code Style | Vue for macOS Ctrl+Alt+S the Settings/Preferences icon

Use this page to configure formatting options for Vue files. When you change these settings, the Preview pane shows how this will affect your code.

Specify which top-level tags should have their content indented, by default, indentation is applied only to code inside template tags. Also decide on whether indentation should be uniform for all top-level tags or depend on the language used, for example, be HTML or Pug-specific.

Tabs and Indents

Specific to the language in the block

Select this option to have the code inside top-level tags indented according to its language-specific style. In the Indent children of top-level tag field, specify the tags where the language-specific indentation should be applied.

By default, the option is cleared, so the Vue.js-specific indentation settings from this page are applied to the code inside all top-level tags listed in the Indent children of top-level tag.

Same in the whole file

By default, the option is selected, so the Vue.js-specific indentation settings from this page are applied to the code inside all top-level tags listed in the Indent children of top-level tag.

Use tab character
  • If this checkbox is selected, tab characters are used:

    • On pressing the Tab key

    • For indentation

    • For reformatting code

  • If the checkbox is cleared, IntelliJ IDEA uses spaces instead of tabs.

Smart tabs

An indentation consists of two parts. One part results from nesting code blocks, and the other part is determined by alignment.

  • If this checkbox is selected, the part that results from nesting contains both tabs and spaces (if necessary), while the part defined by alignment consists only of spaces.

  • If this checkbox is cleared, only tabs are used. This means that after reformatting a group of spaces that fits the specified tab size is automatically replaced with a tab, which may result in breaking fine alignment.

Tab sizeIn this field, specify the number of spaces that fits in a tab.
Indent In this field, specify the number of spaces to be inserted for each indent level.
Continuation indent

In this field, specify the number of spaces to be inserted between the elements of an array, in expressions, method declarations, and method calls.

Keep indents on empty linesIf this checkbox is selected, IntelliJ IDEA retains indents on empty lines as if they contained some code. If the checkbox is cleared, IntelliJ IDEA deletes the tab characters and spaces on empty lines.
Indent children of top-level tag

In this field, specify the top-level tags inside which the code will be indented. The indentation style depends on the selected option, Specific to the language in the block or Same in the whole file.

By default, indentation

Spaces

Use this tab to specify where you want IntelliJ IDEA to insert spaces automatically. Select the checkboxes next to the description of relevant locations and check the results in the Preview pane.

Wrapping and braces

In this tab, customize the exceptions, brace placement and alignment options that IntelliJ IDEA will apply to various code constructs on reformatting the source code. Check the results in the Preview pane.
Visual guides In this field, specify multiple right margins. You can leave a default value or enter the number of spaces for your margin. If you want to specify several margins, enter numbers separated by comma.
Interpolations

In this area, select a wrapping style for interpolations and specify whether you want to have enclosing brackets {{ }} at a new line (default) or not.

Wrapping options

A wrapping style applies to various code constructs, specified in the left-hand pane (for example, method call arguments, or assignment statements).

  • Do not wrap - When this option is selected, no special wrapping style is applied, the nested alignment and braces settings are ignored.

  • Wrap if long - Select this option to wrap lines that go beyond the right margin with proper indentation.

  • Wrap always - Select this option to wrap all elements in lists so that there is one element per line with proper indentation.

  • Chop down if long - Select this option to wrap elements in lists that go beyond the right margin so that there is one element per line with proper indentation.

Set from

The link appears in the upper-right corner of the page, when applicable. Click this link and choose the language to be used as the base for the current language code style.

To return to the initial set of code style settings and discard the changes, click Reset.

Last modified: 10 July 2020