One click reindents and tidies your whole script, using PSScriptAnalyzer’s own formatter (Invoke-Formatter). Keep it light, indentation only, or go full format. Either way it’s a single undo.
This feature is designed and built, but it hasn’t landed in a released version of DetentShell yet. It lives in the Edit menu and on the toolbar in the current development build. When it ships, this page updates to say so and the changelog records it.
Steel text lines with the lower two stepped to the right, and a blue arrow marking the indent. It sits in the Edit menu as Format Document (Shift+Alt+F), and on the toolbar next to the other editing actions.
Both modes are real, and both run through the same formatter. Which one the button uses is a single setting, Format / Indent button applies: in Tools > Settings.
- Indentation focused (the default). Fixes indentation and basic whitespace for the whole script, without moving a single brace. Your own brace placement stays exactly where you put it.
- Full format. Indentation, plus one-true-brace restacking, plus optional aligned assignments: the same scope of change as VS Code’s Format Document.
Every before/after pair below ran through the actual formatter.
Messy indentation, cleaned up
Both modes produce this result.
Before
function Get-LargeFiles{
param([string]$Path,[int]$MinMB=1)
$files=Get-ChildItem $Path -File
foreach($f in $files){
if($f.Length -gt ($MinMB*1MB)){
Write-Output $f.FullName
}
}
}
After
function Get-LargeFiles {
param([string]$Path, [int]$MinMB = 1)
$files = Get-ChildItem $Path -File
foreach ($f in $files) {
if ($f.Length -gt ($MinMB * 1MB)) {
Write-Output $f.FullName
}
}
}
Where the two modes differ: brace style
Already indented, using Allman braces.
Before
function Test-Server
{
param($Server)
if (Test-Path $Server)
{
return $true
}
else
{
return $false
}
}
Indentation focused: brace style untouched (no change here)
Full format: restacked to one true brace
function Test-Server {
param($Server)
if (Test-Path $Server) {
return $true
}
else {
return $false
}
}
A full-format extra: aligned assignments
Before / indentation focused
$server = "sql01"
$port = 1433
$database = "master"
$timeoutSeconds = 30
Full format
$server = "sql01"
$port = 1433
$database = "master"
$timeoutSeconds = 30
The rest of the editor → · What else is planned → · The changelog →
PS> Start-Process "https://detentpoint.com/detentshell/download"
# Coming soon — ships once the installer is code-signed
Coming soon. DetentShell launches at $29.99 in the Microsoft Store for its first two weeks. The regular price that follows is not final yet and will be published here first; volume licensing for teams is handled separately.