3

For whatever reason, in the following command in powershell,

Set-PSReadlineOption -TokenKind Comment -ForegroundColor Gray

I can't see anything after the dash. enter image description here

I am guessing something is off with the colors and I am trying to change it. The key seems to be picking the right TokenKind, which are listed (but not documented) here.

Which TokenKind do I change in order to see text after the dash?

AngryHacker
  • 59,598
  • 102
  • 325
  • 594
  • 2
    Comments in powershell are preceded by `#` or surrounded in block form by `<# #>`. Indeed what you have found are explicitly named parameters (versus positionally-bound parameters). – Maximilian Burszley Aug 30 '18 at 19:29

1 Answers1

5

Found the answer by experimenting. Posting it for the next person that runs into this issue. The TokenKind is Parameter.

Set-PSReadlineOption -TokenKind Parameter -ForegroundColor Yellow
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
  • 2
    Indeed, a token that starts with `-` (informally called _dash_, but strictly speaking [_hyphen-minus_](http://www.fileformat.info/info/unicode/char/2d/index.htm)) is a _parameter [name]_ in PowerShell. Do note that specifying colors changed in PSReadLine _v2_ (to be shipped with PowerShell Core 6.1.0), where a single `-Color` parameter now accepts a hashtable of token-kind-to-color mappings - see https://stackoverflow.com/a/51758846/45375 – mklement0 Aug 30 '18 at 23:09