PowerShell / PowerShell/PSScriptAnalyzer

Extra level of indentation within #region/#endregion tags

Aperta
#1,562 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area - Formatter Issue - Enhancement
Lingua principale
C#
Stelle
2.2k
Fork
414
Merge medio
13h 1m
PR unite (30g)
2

Descrizione

Support indenting an extra level inside regions, both with analyzing and auto-formatting, so it's possible to verify/auto-format code to look like this:

#region
    Get-ChildItem
#endregion

Currently the formatter will do this (because #region/#endregion isn't a token that merits an indent

#region
Get-ChildItem
#endregion

After discussing in the PowerShell slack, I was pointed towards this area where the change would need to be made:
https://github.com/PowerShell/PSScriptAnalyzer/blob/c78f5a60c1f49a5e767286ff6323a2ec0788991a/Rules/UseConsistentIndentation.cs#L146
I believe specifically this would need to be handled in the default part of the switch block.
Per @bergmeister this would most likely get added as a configurable option for the PSUseConsistentIndentation rule.

I'm putting this here because I sort of volunteered to work on it, but it will be a very low priority for me, and also I don't want this information to disappear from the Slack buffer and be gone entirely.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia in Rules/UseConsistentIndentation.cs, nel blocco switch intorno alla riga indicata, in particolare nel relativo default case. Esamina come la regola PSUseConsistentIndentation gestisce la configurazione, quindi definisci la modifica in modo che sia l’analisi sia la formattazione automatica possano indentare il codice all’interno dei tag #region/#endregion. Il lavoro è completato quando il layout della regione mostrato è supportato tramite l’opzione configurabile prevista.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, powershell
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.