Skip to content

Test: Syntax aware folding #44445

@aeschli

Description

@aeschli

Tests #44441

Complexity: 3

A new provider API has been added that lets language extensions provide syntax-driven folding ranges:
https://github.com/Microsoft/vscode/blob/20b5c3a9b5c2352ab45d58287225c5ed061c18f8/src/vs/vscode.proposed.d.ts#L419

Adapters for JSON, HTML and TypeScript have been added, but they are still work in progress and not really tested. Please create a single issue per language with the findings.

  • enable the feature by settings

    • JSON: "json.experimental.syntaxFolding": true
    • HTML: "html.experimental.syntaxFolding": true
    • TypeScript: "typescript.experimental.syntaxFolding": true
  • play around with various file contents:

    • open, verify that fold regions appear. Don't get tricked by the indentation based regions. To make sure that the ranges are syntax-driven (not indentation driven), mess up the indentation.
      • JSON:
        • ranges for objects ({...}) and arrays ([...]) that span over more than 2 lines
        • block comments
        • regions (// #region // #endregion)
      • HTML:
        • ranges for html elements that span over more than 2 lines
        • comments that span over more than 2 lines
        • regions (<!-- #region --> <!-- #endregion -->)
        • no support yet inside embedded content (css/javascript)
      • TypeScript
        • ranges for blocks
        • regions (<!-- #region --> <!-- #endregion -->)
      • verify the behaviour while editing. Folded regions should stay closd
      • try the folding commands:
        - fold/unfold regions
        - fold block comments

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions