Brian Anderson
Brian Anderson

Reputation: 227

Collapse type definition in tsx file in VS Code

When I create a type definition in a typescript file (.ts) I am not given the option to collapse the definition in VS Code. For example:

export type Test = {
    someValue: string,
    someOtherValue: string,
    yetAnotherValue: string
};

I don't get the option in the left margin to collapse this definition. Is there a setting that I'm missing to allow this? Does an extension like prettier have the ability to add this? I have been unable to find a solution so my current workaround is to put a region around it.

Upvotes: 2

Views: 639

Answers (1)

Anton  Kulakov
Anton Kulakov

Reputation: 51

  1. Ctrl + Shift + P Preferences: Open settings(JSON)

  2. Add

"[javascript]": {
    "editor.foldingStrategy": "indentation"
},
"[javascriptreact]": {
    "editor.foldingStrategy": "indentation"
},
"[typescript]": {
    "editor.foldingStrategy": "indentation"
},
"[typescriptreact]": {
    "editor.foldingStrategy": "indentation"
}
  1. That's All

Upvotes: 4

Related Questions