Skip to content

switch statement default clause condition keyword should be flagged as keyword token #10470

@msftrncs

Description

@msftrncs

Summary of the new feature/enhancement

In PowerShell ISE and with PSReadLine, the default clause condition keyword of the switch statement receives only 'bareword' treatment, making it hard to spot relative to other bareword conditions.

(PowerShell 7 with custom PSReadLine theme)
image

(Example shown here with PowerShell/EditorSyntax#156 (which marks the bareword conditions as unquoted strings) and a custom theme in VS Code, with the keyword highlighted)

image

Proposed technical implementation details (optional)

I would propose a change to Parser.GetCommandArgument() that would mark the token as a keyword when it meets the criteria for being the default clause condition keyword.

I can include a commit to PR #10295 that demonstrates this change.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Committee-ReviewedPS-Committee has reviewed this and made a decisionIssue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Languageparser, language semantics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions