JavaScript - Tabs and Indents
Tabs and Indents
Indent style
Property names:
js_indent_style
, indent_style
Possible values:
-
space
: Spaces -
tab
: Tab
Examples:
space |
if·(condition)·{
····if·(condition1)·{
········foo1();
········foo2();
····}·else·{
········foo3();
········foo4();
····}
} |
tab |
if·(condition)·{
→if·(condition1)·{
→→foo1();
→→foo2();
→}·else·{
→→foo3();
→→foo4();
→}
} |
Indent size
Property names:
js_indent_size
, indent_size
Possible values:
an integer
Examples:
value: 0 |
if·(condition)·{
·if·(condition1)·{
··foo1();
··foo2();
·}·else·{
··foo3();
··foo4();
·}
} |
value: 1 |
if·(condition)·{
·if·(condition1)·{
··foo1();
··foo2();
·}·else·{
··foo3();
··foo4();
·}
} |
value: 2 |
if·(condition)·{
··if·(condition1)·{
····foo1();
····foo2();
··}·else·{
····foo3();
····foo4();
··}
} |
Tab width
Property names:
js_tab_width
, tab_width
Possible values:
an integer
Examples:
value: 0 |
if·(condition)·{
→if·(condition1)·{
→→foo1();
→→foo2();
→}·else·{
→→foo3();
→→foo4();
→}
} |
value: 1 |
if·(condition)·{
→if·(condition1)·{
→→foo1();
→→foo2();
→}·else·{
→→foo3();
→→foo4();
→}
} |
value: 2 |
if·(condition)·{
→if·(condition1)·{
→→foo1();
→→foo2();
→}·else·{
→→foo3();
→→foo4();
→}
} |
How to align when tabs are used for indents
Property names:
[resharper_]js_alignment_tab_fill_style
, [resharper_]alignment_tab_fill_style
Possible values:
-
optimal_fill
: Mix tabs and spaces for optimal fill -
use_tabs_only
: Only use tabs (inaccurate) -
use_spaces
: Use spaces (looks aligned on any tab size)
Last modified: 19 April 2018