简体   繁体   English

关闭花括号时如何阻止vscode删除缩进

[英]How to stop vscode from removing indent when closing curly braces

hope you guys can help me out, vscode is removing the indentation when I close curly braces and this is annyoing me, here is a gif of what's happenning希望你们能帮助我,当我关闭花括号时,vscode 正在删除缩进,这让我很生气,这是正在发生的事情的 gif

vscode removing indent vscode 去除缩进

Change Auto Indent in your settings (Text editor) to keep from full .在您的设置(文本编辑器)中更改自动缩进保持完整 (see screenshot below) (见下面的截图)

自动缩进设置

Note: It can affect something another, but it fixes the problem.注意:它可能会影响其他东西,但它可以解决问题。

The reason is your VS code doesn't know about JSX in your JS files.原因是您的 VS 代码不知道 JS 文件中的 JSX。 Try to change your user settings or workspace settings as below:尝试更改您的用户设置或工作区设置,如下所示:

// Place your settings in this file to overwrite the default settings
{
    "files.associations": {
        "*.js": "javascriptreact"
    }
}

Note: You might need to restart VSCode.注意:您可能需要重新启动 VSCode。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM