Skip to content

Commit 85dc335

Browse files
author
James Brundage
committed
Updating PSToken control (fixes #166)
1 parent 01d5160 commit 85dc335

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Formatting/PSToken.control.ps1

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,34 @@ Write-FormatView -AsControl -Name "PSToken" -TypeName "n/a" -Action {
55
$token = $_
66
$prevEnd = $_.PreviousToken.Start + $_.PreviousToken.Length
77
$substring = $_.Text.Substring($prevEnd, $token.Start - $prevEnd)
8-
if ($substring) { $substring} else { ''}
8+
if ($substring) { $substring} else { '' }
99
}
1010

1111
Write-FormatViewExpression -If {
1212
$_.Type -eq 'Comment'
1313
} -ForegroundColor Success -Property Content
1414

1515
Write-FormatViewExpression -If {
16-
$_.Type -in 'Keyword', 'String'
16+
$_.Type -in 'Keyword', 'String', 'CommandArgument'
1717
} -ForegroundColor Verbose -Property Content
1818

1919
Write-FormatViewExpression -If {
2020
$_.Type -in 'Variable', 'Command'
21-
} -ForegroundColor Warning -ScriptBlock {
22-
$_.Content
23-
}
21+
} -ForegroundColor Warning -Property Content
22+
23+
Write-FormatViewExpression -If {
24+
$_.Type -in 'CommandParameter'
25+
} -ForegroundColor Magenta -Property Content
2426

2527
Write-FormatViewExpression -If {
2628
$_.Type -in 'Operator','GroupStart', 'GroupEnd'
27-
} -ForegroundColor Blue -Property Content
29+
} -ForegroundColor Magenta -Property Content
2830

2931
Write-FormatViewExpression -If {
30-
$_.Type -notin 'Comment', 'GroupStart', 'GroupEnd', 'Variable', 'Operator', 'Command','Keyword', 'String'
32+
$_.Type -notin 'Comment',
33+
'Keyword', 'String', 'CommandArgument',
34+
'Variable', 'Command',
35+
'CommandParameter',
36+
'Operator','GroupStart', 'GroupEnd'
3137
} -Property Content
3238
}

0 commit comments

Comments
 (0)