Skip to content

Operators tokens remain flagged as operators after TokenKind is changed to Generic in Command Mode #10348

@msftrncs

Description

@msftrncs

While trying to understand why PSReadLine highlights operator tokens in command mode as operators (though they are not in that context) , I determined that the parser/tokenizer (Tokens Class) has a method that specifically resets the TokenKind of a token, to 'Generic'. However it fails to remove the flags originally set from the original TokenKind. This most commonly occurs to the operators, which in command mode, are not operators and instead are treated as unquoted arguments. PSReadLine uses the TokenFlags UnaryOperator, BinaryOperator and AssignmentOperator to highlight operators, and so that is what it sees

Steps to reproduce

echo 1 + 2 + 3 (1 + 2 + 3)
#      ^   ^ not operators
#                 ^   ^ operators!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions