PowerShell / PowerShell/vscode-powershell
Add support for all token types with the new semantic highlighting
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 547
- PR merge metrics
- No merged PRs in 30d
Description
Summary of the new feature
Powershell has 20 tokentypes and it would be nice if the semantic highlighting supported all of them. See: https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pstokentype
The current semantic highlighting implementation is currently missing the following types:
- Attribute
- CommandArgument
- GroupEnd/GroupStart
- LineContinuation (backtick)
- LoopLabel
- StatementSeparator (Semicolon)
If/When these gets added I would suggest changing the following mappings:
- Value in
Using namespace <Value>should use CommandArgument scope. Currently it uses Function. - Attributes like
[cmdletbinding()]should use Attribute scope. Currently it uses Type. - Names in functions and configurations should use CommandArgument scope. Currently they use the Function scope except functions with no dashes which has no semantic token type.
- Unquoted parameter values like "C:\SomePath" in
Get-ChildItem C:\SomePathshould use CommandArgument scope. Currently they use the function scope.
The following screenshot hopefully shows what I mean:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the current semantic highlighting implementation and compare its token mappings with the documented PowerShell PSTokenType values. Check the listed missing token types and proposed remappings, then verify that all are represented and that the examples use the requested scopes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, typescript
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100