Prettier 没有按规定缩进 [英] Prettier is not indenting as specified

查看:137
本文介绍了Prettier 没有按规定缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Prettier 继续错误地格式化我的代码.我想要 4 个空格作为选项卡(第二张图片),但它忽略了编辑器设置并做了 2 个(第一张图片).

Prettier continues to format my code incorrectly. I desire 4 spaces for tabs (second picture) but it ignores the editor settings and does 2 (first picture).

我知道这是更漂亮的原因,因为当我禁用它时,代码会为我正确缩进.不幸的是,prettier 的其他功能丢失了.我已经尝试卸载并重新安装.

I know it is prettier causing this because when I disable it vs code correctly indents for me. Unfortunately the other functionality of prettier is lost. I have already tried uninstalling and reinstalling.

那么,我缺少哪些设置更改?我肯定错过了什么.任何建议都会很棒.谢谢.

So, what settings changes am I missing? I must be missing something. Any suggestions would be grand. Thanks.

这里是我更改过的所有 prettier 设置.

Here are are all of prettier's settings I have changed.

"prettier.singleQuote": true,
"prettier.eslintIntegration": true,
"prettier.tabWidth": 4,
"prettier.useTabs": true

推荐答案

你在使用 .editorconfig 吗?您可能需要更改(或设置)为

Are you using .editorconfig? You might have to change (or set) to

"editor.tabSize" : 4

也一样.

这篇关于Prettier 没有按规定缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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