如何在VS Code中去除红色边距?

huangapple go评论68阅读模式
英文:

How to remove red margins in VS code?

问题

我在VS code中安装了“prettier”扩展。
并将缩进设置为2个空格。

"prettier.tabWidth": 2,

现在VS code以红色突出显示缩进字段。
VS code希望有4个空格。
如何在VS code中设置2个空格?
或者如何在VS code中去除这个红色突出显示?

英文:

I installed the "prettier" extension in VS code.<br>
With indent settings of 2 spaces.<br>

  &quot;prettier.tabWidth&quot;: 2,

Now VS code highlights the indentation fields in red.<br>
VS code wants there to be 4 spaces.<br>
How can I set 2 spaces in VS code?<br>
Or how can I remove this red highlight in VS code?<br>

如何在VS Code中去除红色边距?

答案1

得分: 0

我找到了解决方案!
这是我的settings.json文件:

// 缩进距离
"prettier.tabWidth": 2,
// 一个制表符对应的空格数
"editor.tabSize": 2,
// 按下TAB键时插入空格。如果启用了"editor.detectIndentation"设置,此设置将根据文件内容进行覆盖。
"editor.insertSpaces": true,
// 基于文件内容,在打开文件时确定是否自动检测"editor.tabSize"和"editor.insertSpaces"。
"editor.detectIndentation": false,
英文:

I found a solution to the problem!<br>
This is my settings.json<br>

// Distance of padding.
&quot;prettier.tabWidth&quot;: 2,
// The number of spaces corresponding to a tab.
&quot;editor.tabSize&quot;: 2,
// Insert spaces when pressing the TAB key. This setting is overridden based on the content of the file if the &quot;editor.detectIndentation&quot; setting is enabled.
&quot;editor.insertSpaces&quot;: true,
// Based on the contents of the file, determines whether &quot;editor.tabSize&quot; and &quot;editor.insertSpaces&quot; are automatically detected when the file is opened.
&quot;editor.detectIndentation&quot;: false,

huangapple
  • 本文由 发表于 2023年1月9日 00:12:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/75049347.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定