Skip to content

Add support for all token types with the new semantic highlighting #2852

Open
@MartinGC94

Description

@MartinGC94

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:\SomePath should use CommandArgument scope. Currently they use the function scope.

The following screenshot hopefully shows what I mean:
Mapping issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions