ReSharper 2025.2 Help

EditorConfig 属性用于 JavaScript:空格

保留现有格式

内部多余空格

属性名称:

[resharper_]js_extra_spaces[resharper_]extra_spaces

可能的值:

  • remove_all :移除所有多余空格

  • leave_tabs :保留多余的制表符

  • leave_multiple :保留多个多余空格

  • leave_all :保留所有多余的空格和制表符

示例:

格式化前

格式化之后,remove_all

x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;
x = foo(5); xx = foo(5 + 6); xxx = foo(5 + 6 + 7); tab = foo(5); tabx = foo(5 + 6); tabxx = foo(5 + 6 + 7);

格式化前

格式化之后,leave_tabs

x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;
x = foo(5); xx = foo(5 + 6); xxx = foo(5 + 6 + 7); tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;

格式化前

格式化之后,leave_multiple

x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;
x = foo(5 ); xx = foo(5 + 6 ); xxx = foo(5 + 6 + 7); tab = foo(5); tabx = foo(5 + 6); tabxx = foo(5 + 6 + 7);

格式化前

格式化之后,leave_all

x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;
x = foo ( 5 ) ; xx = foo ( 5 + 6 ) ; xxx = foo ( 5 + 6 + 7 ) ; tab = foo ( 5 ) ; tabx = foo ( 5 + 6 ) ; tabxx = foo ( 5 + 6 + 7 ) ;

逗号

在逗号后

属性名称:

[resharper_]js_space_after_comma[resharper_]space_after_comma

可能的值:

true | false

示例:

true

foo(a, b, c);

false

foo(a,b,c);

在逗号前

属性名称:

[resharper_]js_space_before_comma[resharper_]space_before_comma

可能的值:

true | false

示例:

true

foo(a , b , c);

false

foo(a, b, c);

分号

分号之前

属性名称:

[resharper_]js_space_before_semicolon[resharper_]space_before_semicolon

可能的值:

true | false

示例:

true

foo(a, b, c) ;

false

foo(a, b, c);

for 语句中的分号前

属性名称:

[resharper_]js_space_before_semicolon_in_for_statement[resharper_]space_before_semicolon_in_for_statement

可能的值:

true | false

示例:

true

for (var i = 1 ; i < 10 ; i++) { }

false

for (var i = 1; i < 10; i++) { }

for 语句中的分号后

属性名称:

[resharper_]js_space_after_semicolon_in_for_statement[resharper_]space_after_semicolon_in_for_statement

可能的值:

true | false

示例:

true

for (var i = 1; i < 10; i++) { }

false

for (var i = 1;i < 10;i++) { }

函数调用中

在括号之前

属性名称:

[resharper_]js_space_before_method_call_parentheses, [resharper_]js_space_between_method_call_name_and_opening_parenthesis, [resharper_]space_before_method_call_parentheses, [resharper_]space_between_method_call_name_and_opening_parenthesis

可能的值:

true | false

示例:

true

foo (a, b, c);

false

foo(a, b, c);

空圆括号前

属性名称:

[resharper_]js_space_before_empty_method_call_parentheses, [resharper_]js_space_between_method_call_name_and_opening_parenthesis, [resharper_]space_before_empty_method_call_parentheses, [resharper_]space_between_method_call_name_and_opening_parenthesis

可能的值:

true | false

示例:

true

foo ();

false

foo();

圆括号内

属性名称:

[resharper_]js_space_between_method_call_parameter_list_parentheses[resharper_]space_between_method_call_parameter_list_parentheses

可能的值:

true | false

示例:

true

foo( a, b, c );

false

foo(a, b, c);

空圆括号内

属性名称:

[resharper_]js_space_between_method_call_empty_parameter_list_parentheses[resharper_]space_between_method_call_empty_parameter_list_parentheses

可能的值:

true | false

示例:

true

foo( );

false

foo();

函数声明中

在括号之前

属性名称:

[resharper_]js_space_before_method_parentheses, [resharper_]js_space_between_method_declaration_name_and_open_parenthesis, [resharper_]space_before_method_parentheses, [resharper_]space_between_method_declaration_name_and_open_parenthesis

可能的值:

true | false

示例:

true

function Foo (a, b) {}

false

function Foo(a, b) {}

匿名方法的圆括号前

属性名称:

[resharper_]js_space_before_method_parentheses_anonymous, [resharper_]js_space_between_method_declaration_name_and_open_parenthesis, [resharper_]space_before_method_parentheses_anonymous, [resharper_]space_between_method_declaration_name_and_open_parenthesis

可能的值:

true | false

示例:

true

function (a, b) {}

false

function(a, b) {}

空圆括号内

属性名称:

[resharper_]js_space_between_method_declaration_empty_parameter_list_parentheses[resharper_]space_between_method_declaration_empty_parameter_list_parentheses

可能的值:

true | false

示例:

true

function Foo( ) {}

false

function Foo() {}

圆括号内

属性名称:

[resharper_]js_space_between_method_declaration_parameter_list_parentheses[resharper_]space_between_method_declaration_parameter_list_parentheses

可能的值:

true | false

示例:

true

function Foo( a, b ) {}

false

function Foo(a, b) {}

在控制语句中

在括号之前

属性名称:

[resharper_]js_space_after_keywords_in_control_flow_statements[resharper_]space_after_keywords_in_control_flow_statements

可能的值:

true | false

示例:

true

while (condition) { }

false

while(condition) { }

圆括号内

属性名称:

[resharper_]js_space_between_parentheses_of_control_flow_statements[resharper_]space_between_parentheses_of_control_flow_statements

可能的值:

true | false

示例:

true

do { } while ( condition )

false

do { } while (condition)

索引表达式中

中括号前

属性名称:

[resharper_]js_space_before_array_access_brackets, [resharper_]js_space_before_open_square_brackets, [resharper_]space_before_array_access_brackets, [resharper_]space_before_open_square_brackets

可能的值:

true | false

示例:

true

a [i]

false

a[i]

中括号内

属性名称:

[resharper_]js_space_within_array_access_brackets, [resharper_]js_space_between_square_brackets, [resharper_]space_within_array_access_brackets, [resharper_]space_between_square_brackets

可能的值:

true | false

示例:

true

a[ i ]

false

a[i]

三元运算符 '?' :'

在三元运算符 '?' 中 :'

属性名称:

[resharper_]js_space_before_ternary_quest[resharper_]space_before_ternary_quest

可能的值:

true | false

示例:

true

a ? b : c

false

a? b : c

在 '?' 后

属性名称:

[resharper_]js_space_after_ternary_quest[resharper_]space_after_ternary_quest

可能的值:

true | false

示例:

true

a ? b : c

false

a ?b : c

':' 前

属性名称:

[resharper_]js_space_before_ternary_colon[resharper_]space_before_ternary_colon

可能的值:

true | false

示例:

true

a ? b : c

false

a ? b: c

在 '?' 后

属性名称:

[resharper_]js_space_after_ternary_colon[resharper_]space_after_ternary_colon

可能的值:

true | false

示例:

true

a ? b : c

false

a ? b :c

对象表达式中

':' 前

属性名称:

[resharper_]js_space_before_property_colon[resharper_]space_before_property_colon

可能的值:

true | false

示例:

true

var o = { a : b }

false

var o = { a: b }

在 '?' 后

属性名称:

[resharper_]js_space_after_property_colon[resharper_]space_after_property_colon

可能的值:

true | false

示例:

true

var o = { a: b }

false

var o = { a:b }

大括号内

属性名称:

[resharper_]js_space_within_object_literal_braces[resharper_]space_within_object_literal_braces

可能的值:

true | false

示例:

true

var o = { a: b }

false

var o = {a: b}

空大括号内

属性名称:

[resharper_]js_space_within_empty_object_literal_braces[resharper_]space_within_empty_object_literal_braces

可能的值:

true | false

示例:

true

var o = { }

false

var o = {}

import 声明中

大括号内

属性名称:

[resharper_]js_space_within_import_braces[resharper_]space_within_import_braces

可能的值:

true | false

示例:

true

import { Component, EventEmitter, OnInit, Output, Input } from '@angular/core';

false

import {Component, EventEmitter, OnInit, Output, Input} from '@angular/core';

数组字面量中

中括号内

属性名称:

[resharper_]js_space_within_array_literal_brackets, [resharper_]js_space_between_square_brackets, [resharper_]space_within_array_literal_brackets, [resharper_]space_between_square_brackets

可能的值:

true | false

示例:

true

[ a, b, c ]

false

[a, b, c]

空中括号内

属性名称:

[resharper_]js_space_within_empty_array_literal_brackets, [resharper_]js_space_between_empty_square_brackets, [resharper_]space_within_empty_array_literal_brackets, [resharper_]space_between_empty_square_brackets

可能的值:

true | false

示例:

true

[ ]

false

[]

在表达式中

二元运算符周围

属性名称:

[resharper_]js_space_around_binary_operator[resharper_]space_around_binary_operator

可能的值:

true | false

示例:

true

a + b

false

a+b

赋值运算符周围

属性名称:

[resharper_]js_space_around_assignment_operator[resharper_]space_around_assignment_operator

可能的值:

true | false

示例:

true

a = b;

false

a=b;

点周围

属性名称:

[resharper_]js_space_around_dot, [resharper_]js_space_around_member_access_operator, [resharper_]space_around_dot, [resharper_]space_around_member_access_operator

可能的值:

true | false

示例:

true

obj . toString()

false

obj.toString()

圆括号内

属性名称:

[resharper_]js_space_within_parentheses[resharper_]space_within_parentheses

可能的值:

true | false

示例:

true

( a + b ).toString();

false

(a + b).toString();

case 语句

逗号前

属性名称:

[resharper_]js_space_before_colon_in_case[resharper_]space_before_colon_in_case

可能的值:

true | false

示例:

true

switch (a) { case b : break; }

false

switch (a) { case b: break; }

Lambda 表达式

':' 前

属性名称:

[resharper_]js_space_before_arrow[resharper_]space_before_arrow

可能的值:

true | false

示例:

true

var v = (a, b, c) => a + b + c;

false

var v = (a, b, c)=> a + b + c;

lambda 表达式中的 '=>' 后

属性名称:

[resharper_]js_space_after_arrow[resharper_]space_after_arrow

可能的值:

true | false

示例:

true

var v = (a, b, c) => a + b + c;

false

var v = (a, b, c) =>a + b + c;

模板字面量

模板实参周围的大括号内

属性名称:

[resharper_]js_space_within_template_argument[resharper_]space_within_template_argument

可能的值:

true | false

示例:

true

var v = `${ a } ${ x + y }`

false

var v = `${a} ${x + y}`
最后修改日期: 2025年 9月 27日