TypeScript 的 EditorConfig 属性:换行符
空行
字段和签名声明周围的最少空行数
属性名称:
[resharper_]js_min_blank_lines_around_fields, [resharper_]min_blank_lines_around_fields
可能的值:
一个整数
示例:
格式化前 | 格式化后,值:0 |
|---|---|
class C {
public f1: number;
public f2: number;
}
| class C {
public f1: number;
public f2: number;
}
|
格式化前 | 格式化后,值:1 |
|---|---|
class C {
public f1: number;
public f2: number;
}
| class C {
public f1: number;
public f2: number;
}
|
格式化前 | 格式化后,值:2 |
|---|---|
class C {
public f1: number;
public f2: number;
}
| class C {
public f1: number;
public f2: number;
}
|
类型和模块周围的最少空行数
属性名称:
[resharper_]js_min_blank_lines_around_types, [resharper_]min_blank_lines_around_types
可能的值:
一个整数
示例:
格式化前 | 格式化后,值:0 |
|---|---|
class C1 {
public f: number;
}
class C2 {
public f: number;
}
| class C1 {
public f: number;
}
class C2 {
public f: number;
}
|
格式化前 | 格式化后,值:1 |
|---|---|
class C1 {
public f: number;
}
class C2 {
public f: number;
}
| class C1 {
public f: number;
}
class C2 {
public f: number;
}
|
格式化前 | 格式化后,值:2 |
|---|---|
class C1 {
public f: number;
}
class C2 {
public f: number;
}
| class C1 {
public f: number;
}
class C2 {
public f: number;
}
|
换行
枚举
属性名称:
[resharper_]js_wrap_enum_style, [resharper_]wrap_enum_style
可能的值:
不更改: 不更改on_single_line: 强制放在单行line_break: 强制换行
示例:
格式化前 | 格式化后,do_not_change |
|---|---|
enum A { A1, A2, A3 }
enum B {
B1,
B2,
B3,
}
| enum A { A1, A2, A3 }
enum B {
B1,
B2,
B3,
}
|
格式化前 | 格式化后,on_single_line |
|---|---|
enum A { A1, A2, A3 }
enum B {
B1,
B2,
B3,
}
| enum A { A1, A2, A3 }
enum B { B1, B2, B3, }
|
格式化前 | 格式化后,line_break |
|---|---|
enum A { A1, A2, A3 }
enum B {
B1,
B2,
B3,
}
| enum A {
A1,
A2,
A3
}
enum B {
B1,
B2,
B3,
}
|
换行与拆分
将联合类型用法换行
属性名称:
[resharper_]js_wrap_union_type_usage, [resharper_]wrap_union_type_usage
可能的值:
wrap_if_long:简单换行chop_if_long:如果过长或多行则分割chop_always:始终分割
示例:
格式化前 | 格式化后,wrap_if_long |
|---|---|
type A = 'first' | 'second' |
'third';
type B = 'x' | 'y' | 'z';
type C = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
| type A = 'first' | 'second' |
'third';
type B = 'x' | 'y' | 'z';
type C = 'a' | 'b' | 'c' |
'd' | 'e' | 'f' |
'g' | 'h' | 'i' |
'j' | 'k' | 'l' |
'm' | 'n' | 'o' |
'p' | 'q' | 'r' |
's' | 't' | 'u' |
'v' | 'w' | 'x' |
'y' | 'z';
|
格式化前 | 格式化后,chop_if_long |
|---|---|
type A = 'first' | 'second' |
'third';
type B = 'x' | 'y' | 'z';
type C = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
| type A = 'first' |
'second' |
'third';
type B = 'x' | 'y' | 'z';
type C = 'a' |
'b' |
'c' |
'd' |
'e' |
'f' |
'g' |
'h' |
'i' |
'j' |
'k' |
'l' |
'm' |
'n' |
'o' |
'p' |
'q' |
'r' |
's' |
't' |
'u' |
'v' |
'w' |
'x' |
'y' |
'z';
|
格式化前 | 格式化后,chop_always |
|---|---|
type A = 'first' | 'second' |
'third';
type B = 'x' | 'y' | 'z';
type C = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
| type A = 'first' |
'second' |
'third';
type B = 'x' |
'y' |
'z';
type C = 'a' |
'b' |
'c' |
'd' |
'e' |
'f' |
'g' |
'h' |
'i' |
'j' |
'k' |
'l' |
'm' |
'n' |
'o' |
'p' |
'q' |
'r' |
's' |
't' |
'u' |
'v' |
'w' |
'x' |
'y' |
'z';
|
放置在新行上
将每个装饰器置于新行中
属性名称:
[resharper_]js_place_each_decorator_on_new_line, [resharper_]place_each_decorator_on_new_line
可能的值:
true|false
示例:
true |
|---|
@test
class A {
@test
@custom
m() {
}
};
|
false |
|---|
@test
class A {
@test @custom
m() {
}
};
|
类装饰器与类在同一行
属性名称:
[resharper_]js_place_class_decorator_on_the_same_line, [resharper_]place_class_decorator_on_the_same_line
可能的值:
true|false
示例:
true |
|---|
@test class A {
@test @custom
m() {
}
};
|
false |
|---|
@test
class A {
@test @custom
m() {
}
};
|
方法装饰器与签名在同一行
属性名称:
[resharper_]js_place_method_decorator_on_the_same_line, [resharper_]place_method_decorator_on_the_same_line
可能的值:
true|false
示例:
true |
|---|
@test
class A {
m()
@test @custom m() {
}
};
|
false |
|---|
@test
class A {
m()
@test @custom
m() {
}
};
|
属性装饰器与属性在同一行
属性名称:
[resharper_]js_place_property_decorator_on_the_same_line, [resharper_]place_property_decorator_on_the_same_line
可能的值:
true|false
示例:
true |
|---|
@test
class A {
@test @custom
set m(q) {
}
@test @custom
get m() {
return null;
}
};
|
false |
|---|
@test
class A {
@test @custom
set m(q) {
}
@test @custom
get m() {
return null;
}
};
|
字段装饰器与字段在同一行
属性名称:
[resharper_]js_place_field_decorator_on_the_same_line, [resharper_]place_field_decorator_on_the_same_line
可能的值:
true|false
示例:
true |
|---|
@test
class A {
@test @custom
f;
};
|
false |
|---|
@test
class A {
@test @custom
f;
};
|