Search code examples
javascriptvisual-studio-codefolding

How to enable multiline JS strings folding (hiding) in VSCode?


In VSCode, like in every modern code editor, we can fold (hide) functions, classes etc. basing on their scope. But I'd like to extend this behavior for working also in case of multiline JS strings. I have such an object:

const myObject = {
  myKey1: multiline(`

    some

    very

    long

    multiline

    string


  `),
  myKey2: multiline(`

    another

    very

    long

    multiline

    string


  `)
}

Now I can only fold the whole object in VSCode, but I'd like to fold only some chosen multiline string. Is it possible?


Solution

  • Okay, I found the best solution for me: just to change folding strategy from auto to indentation:

    enter image description here

    But thanks for your suggestions guys!