PowerShell / PowerShell/PSScriptAnalyzer

Add setting to better toggle block comments

Open
#1,428 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Force block comment start (<#) and end (#>) to be on their own line and indent contents

When toggling a block comment the contents are not indented and if white space was not selected the start and end tags will not be on their own lines.
I propose a setting (or two) that would force a newline for the start and end tags and possibly indent the contents. This way when someone goes to toggle block comment it would already be pretty inline with outlined in https://github.com/PoshCode/PowerShellPracticeAndStyle.

Perhaps a dropdown with block comment style similar to the pipeline indentation style option.

I would like that when you toggle block comment that it matches the definition in https://github.com/PoshCode/PowerShellPracticeAndStyle/blob/master/Style-Guide/Documentation-and-Comments.md
This is to say the start and end tags on their own lines and the content indented once.

Appreciate any consideration to add this!

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 by locating the toggle block comment implementation and the existing pipeline indentation style setting in PSScriptAnalyzer. Compare the current behavior with the linked PowerShellPracticeAndStyle guidance. Done means the chosen setting or settings put <# and #> on their own lines and indent the block contents when comments are toggled.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.