Search code examples
visual-studio-codeprettier

How to remove red margins in VS code?


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

  "prettier.tabWidth": 2,

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

enter image description here


Solution

  • I found a solution to the problem!
    This is my settings.json

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