Visual studio code VS代码-格式化时如何对齐标记末端和标记开口?(JSX)
我不知道这是否是VS代码的默认行为(在默认配置之上我有很多自定义配置) 但当我格式化代码时,它会转换这样的代码:Visual studio code VS代码-格式化时如何对齐标记末端和标记开口?(JSX),visual-studio-code,jsx,vscode-settings,Visual Studio Code,Jsx,Vscode Settings,我不知道这是否是VS代码的默认行为(在默认配置之上我有很多自定义配置) 但当我格式化代码时,它会转换这样的代码: const simpleInput = ( <Input {...input} {...others} state={state} /> ); const simpleInput=( ); 进入: const simpleInput = ( <Input {...input}
const simpleInput = (
<Input
{...input}
{...others}
state={state}
/>
);
const simpleInput=(
);
进入:
const simpleInput = (
<Input
{...input}
{...others}
state={state}
/> <- Here is the difference
);
const simpleInput=(
VSCode使用底层自动格式化
TypeScript回购中最近有一个问题与您的问题相同:
这些变化还没有反映到VSCode稳定版本中,但在VSCode内部人员()的当前版本中,标记与结束括号对齐
您可以下载并使用VSCode Insiders,或更改您的eslint规则,以使用对齐的支柱(方括号),直到它进入稳定版本:
“react/jsx闭合支架位置”:[
“警告”,
“道具对齐”
],
这是一个解决方案,而不是解决方案。不过,感谢您的分享,这有助于更好地理解问题!:)