如何在VSCode中自动缩进jsx [英] How to auto indent jsx in VSCode

查看:238
本文介绍了如何在VSCode中自动缩进jsx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VSCode似乎不会在jsx中自动缩进HTML元素?

VSCode seems doesn't auto indent HTML elements in jsx?

有什么办法可以解决它.

Is there any way to fix it.

更新:

Atom 中:

当我输入<div>时,原子将显示:

When I input <div>, atom will show:

return键后,结果为(注意光标的位置):

After I press the return key, the result is(pay attention to the location of the cursor):

VSCode 中:

推荐答案

尝试将语言模式更改为JavaScript React.

Try changing the language mode to JavaScript React.

  1. 打开命令面板.
  2. 键入change language mode
  3. Enter
  4. 键入javascript react
  5. Enter
  1. Open the commands palette.
  2. Type change language mode
  3. Press Enter
  4. Type javascript react
  5. Press Enter

完成后,您将在左下角看到JavaScript React模式.

Once that's done, you'll see the JavaScript React mode in the bottom left corner.

一旦处于该模式,请再次尝试格式化文档.

Once you're in that mode, try again to format the document.

这篇关于如何在VSCode中自动缩进jsx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆