microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.69k stars 769 forks source link

TextMate grammar for python doesn't correctly handle `match` statement followed by `~` token #4753

Open erictraut opened 12 months ago

erictraut commented 12 months ago

I realize that the TextMate grammar for Python ships with VS Code and the code is in the MagicPython repo, but I'm filing this here because the Pylance team is tracking a few other TextMate grammar issues.

The grammar apparently doesn't handle the case where a match (soft) keyword is followed by a ~ token.

match ~1:
    case _:
        pass

Note how it works correctly for other unary operators.

image

debonte commented 5 months ago

Repros on 2024.2.105. Note that semantic highlighting covers up this issue. You can see the coloring that Eric showed above by setting "editor.semanticHighlighting.enabled": false