Skip to content

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

Closed

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

Activity

  1. added
    Review - CommitteeThe PR/Issue needs a review from the PowerShell Committee
    WG-Enginecore PowerShell engine, interpreter, and runtime
    WG-Languageparser, language semantics
    and removed
    WG-Enginecore PowerShell engine, interpreter, and runtime
    on Sep 3, 2019
  2. joeyaiello commented on Sep 4, 2019

    @joeyaiello
    Contributor

    Conceptually, @PowerShell/powershell-committee agrees that this behavioral part of the change is fine. We defer to the Maintainers and Area Experts to review the technical and implementation aspects of the code. (And we expect that they'll mandate you include some tests in your PR as well :) )

    Having looked over #10295, we'd prefer that you add your proposed commit to a separate PR.

    But hey, thanks for the change. I always appreciate seeing improvements to syntax highlighting.

  3. added
    Committee-ReviewedPS-Committee has reviewed this and made a decision
    and removed
    Review - CommitteeThe PR/Issue needs a review from the PowerShell Committee
    on Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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