PowerShell / PowerShell/PSScriptAnalyzer
Code Formatting : Whitespacing one line hashtable
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 2.2k
- Forks
- 414
- Ø Merge
- 13 Std. 1 Min.
- Gemergte PRs (30 T.)
- 2
Beschreibung
Hello
I am looking for a improvment on the current formatting tools by adding a whitespace after open bracket and before closing non empty curly brackets like :
#Actual
$emptyHash = @{ } # an empty Hash
$myHash = @{foo = "bar"}
#Expected
$emptyHash = @{} # an empty Hash
$myHash = @{ foo = "bar" } #whitespace after `{ `and before ` }`
Additional information:
-
I use the PowerShell extension on VS Code to format automaticaly my code on save.
-
My settings.json file:
{
"editor.formatOnSave": true,
"powershell.codeFormatting.preset": "Custom",
"powershell.codeFormatting.alignPropertyValuePairs": true,
"powershell.codeFormatting.ignoreOneLineBlock": false,
"powershell.codeFormatting.newLineAfterCloseBrace": true,
"powershell.codeFormatting.newLineAfterOpenBrace": true,
"powershell.codeFormatting.openBraceOnSameLine": false,
"powershell.codeFormatting.whitespaceAfterSeparator": true,
"powershell.codeFormatting.whitespaceAroundOperator": true,
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
"powershell.codeFormatting.whitespaceBeforeOpenParen": true,
"powershell.scriptAnalysis.enable": true,
"files.trimTrailingWhitespace": true,
}
This feature exist on other language :
https://github.com/Microsoft/TypeScript/issues/9613#issuecomment-268460847
Regards,
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Das Issue nennt keine Dateien oder Tests. Beginne damit, die PowerShell-Codeformatierungsbehandlung für einzeilige hashtables zu finden, und reproduziere die Beispiele im Issue mit den aufgeführten benutzerdefinierten Einstellungen. Die Aufgabe ist abgeschlossen, wenn nicht leere Hashtables mit geschweiften Klammern umgebenden Whitespace erhalten, während leere Hashtables unverändert bleiben, mit Testabdeckung für beide Fälle.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp, powershell
- Bereich
- developer-experience, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100