Roma Kim
Roma Kim

Reputation: 371

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

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.

Upvotes: 1

Views: 552

Answers (3)

Dawood Ahmad
Dawood Ahmad

Reputation: 474

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.

Upvotes: 1

RobLjm
RobLjm

Reputation: 429

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

Upvotes: 1

Sobhan Jahanmard
Sobhan Jahanmard

Reputation: 890

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

Upvotes: 1

Related Questions