MagicStack / MagicStack/MagicPython

Tokenization for match-case

Open
#235 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.4k
Forks
98
PR merge metrics
No merged PRs in 30d

Description

Originally from @SNvMK in https://github.com/microsoft/vscode/issues/120734

So, in python 3.10, there is match/case syntax. Currently, it is just white words(for monokai). I'd like if you add highlight for this. Thanks
image

a = 'world'
match a:
    case 'world':
        print('Hello!')
    case _:
        print('I dont know you!')

Currently the match and case are only tokenized as source.python.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Python tokenization rules used by this syntax highlighter and compare the handling of the match/case example in the issue with existing keyword rules. Done means match and case receive appropriate syntax highlighting in the supported editors, without changing unrelated Python highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.