Skip to content

Syntax folding should differentiate between regions and comment blocks #1437

Closed
@glennsarti

Description

@glennsarti

System Details

  • Operating system name and version: N/A
  • VS Code version: N/A
  • PowerShell extension version: N/A
  • Output from $PSVersionTable: N/A

Issue Description

While working on #1428 I thought of another possible issue with the syntax folding. Currently regions and comment blocks are detected as the same thing which will cause issues when comments are not separated by empty lines.

Given a script of

# Comment Block 1
# Comment Block 1
# Comment Block 1
#region
# Comment Block 2
# Comment Block 2
# Comment Block 2
$something = $true
#endregion

Expected Folding Regions

# Comment Block 1  --+-- Folding Line 1-3
# Comment Block 1    |
# Comment Block 1  --+
#region                                   --+-- Folding Line 4-9
# Comment Block 2  --+-- Folding Line 5-7   |
# Comment Block 2    |                      |
# Comment Block 2  --+                      |
$something = $true                          |
#endregion                                --+

Actual Folding regions

# Comment Block 1  --+-- Folding Line 1-7
# Comment Block 1    |
# Comment Block 1    |
#region              |  --+-- Folding Line 4-9
# Comment Block 2    |    |
# Comment Block 2    |    |
# Comment Block 2  --+    |
$something = $true        |
#endregion              --+

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions