Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code VS代码-格式化时如何对齐标记末端和标记开口?(JSX)_Visual Studio Code_Jsx_Vscode Settings - Fatal编程技术网

Visual studio code VS代码-格式化时如何对齐标记末端和标记开口?(JSX)

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}

我不知道这是否是VS代码的默认行为(在默认配置之上我有很多自定义配置)

但当我格式化代码时,它会转换这样的代码:

  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闭合支架位置”:[
“警告”,
“道具对齐”
],

这是一个解决方案,而不是解决方案。不过,感谢您的分享,这有助于更好地理解问题!:)