Author Topic: PowerShell Colors: Identifier  (Read 549 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
PowerShell Colors: Identifier
« on: November 15, 2022, 11:07:31 PM »
By default, "Identifier" is colored about the same as plain text.
Why is this?

When I change Identifier to be distinct I found that almost everything in a PowerShell script is colored as Identifier.

I was trying to get more cmdlets colored is keywords and started comparing coloring to VSCode.

Notably missing from keywords is "help".
Also it might be good to color anything of the pattern "{Verb}-{Noun}", where Verb could be the list of Approved verbs. (See the Get-Verb cmdlet). There are about 100 of these.

On my machine though 25 verbs cover 95% of the cmdlets: (10,223 of 10,658)

Code: [Select]
Add
Clear
Connect
ConvertTo
Copy
Disable
Disconnect
Enable
Export
Get
Import
Initialize
Invoke
Move
New
Remove
Rename
Restart
Set
Start
Stop
Suspend
Test
Update

Verb
Add
Clear
Connect
ConvertTo
Copy
Disable
Disconnect
Enable
Export
Get
Import
Initialize
Invoke
Move
New
Remove
Rename
Restart
Set
Start
Stop
Suspend
Test
Update


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6864
  • Hero Points: 528
Re: PowerShell Colors: Identifier
« Reply #1 on: November 16, 2022, 01:57:55 AM »
In some languages like PowerShell which are very adhock, identifier color isn't very helpful. The color coding engine is really just a fancy lexer and not a parser/compiler with full BNF. Full BNF isn't even enough for some languages where you can't determine what something is until run-time (ex. Perl).