Questions & Answers

Customize code folding for .js and .jsx files in vscode to achieve folding of className='...'

I am looking to fold the className attribute in my react app, as I am using tailwindcss and thus the classNames get quite long, cluttering my files. I've come across code folding based on start and end identifiers using regex, but am unsure as to how I go about editing the javascript-language.configuration.json file.

I'm thinking of setting the start identifier to className=' and the end identifier to '

How do I open this file, and is it even possible to code fold within a single line?

for example, I would like to convert the following:

   <div className='some-superlong list-of-tailwind utility-classes that clutter-up this-file'>
      <p className='some-more utility-classes that-need to get-folded'>

into something like this:

   <div className...>
      <p className...>
2023-01-17 00:47:36
I swear I saw an extension for this somewhere that I completely forgot about. Do have any idea on this?
2023-01-17 00:47:36
Related VS Code issue and extension.
Answers(1) :

Install a plugin called Inline Fold.

If it its not working for JSX or TSX Simply go to vscode settings and search for inline fold settings and add jsx and tsx as of the supported languages and then reload.

See ; settings

This is now my tsx file with tailwind with folding enabled.