JavaScript の EditorConfig プロパティ: 波括弧レイアウト
波括弧レイアウト
空の波括弧フォーマット
プロパティ名:
[resharper_]js_empty_block_style , [resharper_]empty_block_style
使用可能な値:
multiline: 異なる行together: 波括弧を一緒に配置するtogether_same_line: 一緒に同じ行に
例:
フォーマット前 | フォーマット後 multiline |
|---|---|
function func(par1,
par2) {} | function func(par1,
par2) {
} |
フォーマット前 | フォーマット後 together |
|---|---|
function func(par1,
par2) {} | function func(par1,
par2) {} |
フォーマット前 | フォーマット後 together_same_line |
|---|---|
function func(par1,
par2) {} | function func(par1,
par2) {} |
機能
プロパティ名:
[resharper_]js_function_braces、[resharper_]js_brace_style、[resharper_]function_braces、[resharper_]brace_style
使用可能な値:
end_of_line: 行末 (K&R スタイル)end_of_line_no_space: 行末 (空白なし)next_line: 次の行に (BSD スタイル)next_line_shifted: 次の行のインデント時に (ホワイトスミススタイル)next_line_shifted_2: 次の行インデント 2 (GNU スタイル)pico: コンパクト (ピコスタイル)
例:
end_of_line |
|---|
function foo() {
bar();
} |
end_of_line_no_space |
|---|
function foo(){
bar();
} |
next_line |
|---|
function foo()
{
bar();
} |
next_line_shifted |
|---|
function foo()
{
bar();
} |
next_line_shifted_2 |
|---|
function foo()
{
bar();
} |
ピコ |
|---|
function foo() { bar(); } |
他の関数呼び出しにパラメーターとして渡される関数
プロパティ名:
[resharper_]js_function_in_invocation_braces、[resharper_]js_brace_style、[resharper_]function_in_invocation_braces、[resharper_]brace_style
使用可能な値:
end_of_line: 行末 (K&R スタイル)end_of_line_no_space: 行末 (空白なし)next_line: 次の行に (BSD スタイル)next_line_shifted: 次の行のインデント時に (ホワイトスミススタイル)next_line_shifted_2: 次の行インデント 2 (GNU スタイル)pico: コンパクト (ピコスタイル)
例:
end_of_line |
|---|
bar(function foo() {
bar();
}); |
end_of_line_no_space |
|---|
bar(function foo(){
bar();
}); |
next_line |
|---|
bar(function foo()
{
bar();
}); |
next_line_shifted |
|---|
bar(function foo()
{
bar();
}); |
next_line_shifted_2 |
|---|
bar(function foo()
{
bar();
}); |
ピコ |
|---|
bar(function foo() { bar(); }); |
制御ステートメント
プロパティ名:
[resharper_]js_control_statements_braces、[resharper_]js_brace_style、[resharper_]control_statements_braces、[resharper_]brace_style
使用可能な値:
end_of_line: 行末 (K&R スタイル)end_of_line_no_space: 行末 (空白なし)next_line: 次の行に (BSD スタイル)next_line_shifted: 次の行のインデント時に (ホワイトスミススタイル)next_line_shifted_2: 次の行インデント 2 (GNU スタイル)pico: コンパクト (ピコスタイル)
例:
end_of_line |
|---|
while (cond) {
Action();
};
do {
Action();
} while (cond); |
end_of_line_no_space |
|---|
while (cond){
Action();
};
do{
Action();
} while (cond); |
next_line |
|---|
while (cond)
{
Action();
};
do
{
Action();
} while (cond); |
next_line_shifted |
|---|
while (cond)
{
Action();
};
do
{
Action();
} while (cond); |
next_line_shifted_2 |
|---|
while (cond)
{
Action();
};
do
{
Action();
} while (cond); |
ピコ |
|---|
while (cond)
{ Action(); };
do
{ Action(); } while (cond); |
インデント括弧、角括弧および式波括弧
プロパティ名:
[resharper_]js_indent_pars , [resharper_]indent_pars
使用可能な値:
inside: 括弧内 (BSD/K&R スタイル)outside: 括弧内と等しく (ホワイトスミススタイル)outside_and_inside: 括弧 1x、2x の内側 (GNU スタイル)none: インデントしない
例:
内部 |
|---|
a =
{
1,
2,
3
};
b =
(
1 + 2
) |
外側 |
|---|
a =
{
1,
2,
3
};
b =
(
1 + 2
) |
outside_and_inside |
|---|
a =
{
1,
2,
3
};
b =
(
1 + 2
) |
なし |
|---|
a =
{
1,
2,
3
};
b =
(
1 + 2
) |
波括弧を強制する
ステートメント内の波括弧
プロパティ名:
[resharper_]js_force_control_statements_braces , [resharper_]force_control_statements_braces
使用可能な値:
do_not_change: 変更しないalways_remove: 波括弧の除去always_add: 波括弧の追加only_for_multiline: 複数行に波括弧を使用する
例:
フォーマット前 | フォーマット後 do_not_change |
|---|---|
if (condition) {
foo();
}
else
while (condition)
foo(); | if (condition) {
foo();
} else
while (condition)
foo(); |
フォーマット前 | フォーマット後 always_remove |
|---|---|
if (condition) {
foo();
}
else
while (condition)
foo(); | if (condition) foo();
else
while (condition)
foo(); |
フォーマット前 | フォーマット後 always_add |
|---|---|
if (condition) {
foo();
}
else
while (condition)
foo(); | if (condition) {
foo();
} else {
while (condition) {
foo();}} |
フォーマット前 | フォーマット後 only_for_multiline |
|---|---|
if (condition) {
foo();
}
else
while (condition)
foo(); | if (condition) foo();
else {
while (condition)
foo();} |
Case ステートメント
'switch' から 'case' をインデント
プロパティ名:
[resharper_]js_indent_switch_labels , [resharper_]indent_switch_labels
使用可能な値:
true | false
例:
true |
|---|
switch (expression) {
case 0:
break;
} |
false |
|---|
switch (expression) {
case 0:
break;
} |