Home > Software engineering >  How to keep VSCode from spreading information on multiple lines in React? (formatting)
How to keep VSCode from spreading information on multiple lines in React? (formatting)

Time:09-21

I have a following code in React which I want to keep in a single line shown below:

<Title level={2} className="heading">Global Crypto Stats</Title>

However, on saving my file I get a code spread on multiple lines like that:

<Title level={2} className="heading">
    Global Crypto Stats
  </Title>

I'm not sure whether it is prettier or VSCode on safe function. Can't seem to find it. This isn't "Toggle Word Wrap" (Alt Z) function.

CodePudding user response:

go to file>preferences>settings on top, search format on save and remove the tic that says Edit:format on save

CodePudding user response:

Select the lines you want to join and Ctrl J on Mac. Or Press F1 and "Join Lines"

CodePudding user response:

it's because you have code format extensions installed, which formate your code in this way, you may have "Prettier" installed or some other extensions. uninstall or disable those extensions, your problem will be solved.

  • Related