Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Folding Styled Components Consts in VSCode

I have been using Styled Components in NextJS/React and I love it. Generally, I break my styles out into separate js files, but because I am relatively new to React, props, hooks, and context and such, I often find need to keep my styles in my component files. My question is how do I, in VSCode, fold the following code:

const SomeStyledComponent = styled.div`
  height: 300px;
  width: 300px;
  ...
`;

It would go a long way to make my coding life easier.

Thank You

like image 638
Tithos Avatar asked Nov 02 '25 04:11

Tithos


1 Answers

You can use the indentation code folding strategy.

// settings.json
{
//  ...other settings
    "editor.foldingStrategy": "indentation",
}

From the settings doc:

Controls the strategy for computing folding ranges. auto uses a language specific folding strategy, if available. indentation uses the indentation based folding strategy.

like image 194
Martin Avatar answered Nov 04 '25 19:11

Martin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!