PowerShell / PowerShell/PSScriptAnalyzer

Option to indent code in a #region

Open
#1,792 4 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Formatter Issue - Enhancement Up for Grabs
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
Summary

When writing code, I depend heavily on regions to keep things clean. Sometimes even nested regions. I would love it if we have the option to indent the code in a region to easily find where a region starts and ends.

#region: Hello World!
Write-Host 'Hello World!
#endregion

Should be (optinally)

#region: Hello World!
    Write-Host 'Hello World!
#endregion

Would be even cooler if the indent is adjustable to 1 or 2 spaces instead of 4

Proposed Design

Add option in the formatter to indent regions and specifying by how many spaces.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the formatter entry point described in the issue and determine how region boundaries and indentation are currently handled. Define the configurable indentation amount and verify that formatting optionally indents code inside nested regions while preserving the existing behavior when the option is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.