Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip nonrelevant cases in match/case during step by step debugging #1565

Open
Real-Gecko opened this issue Apr 16, 2024 · 2 comments
Open

Skip nonrelevant cases in match/case during step by step debugging #1565

Real-Gecko opened this issue Apr 16, 2024 · 2 comments

Comments

@Real-Gecko
Copy link

When debugging C application inf VSCode I've noticed that step by step debugging(F10) through switch/case "jumps" immediately to the matched case.
OTOH while debugging Python's match/case debugger is stopped on every case statement so you have to spam F10 constantly to get to the proper condition and continue execution.
Anyway to prevent this from happening?

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Apr 16, 2024
@int19h
Copy link
Contributor

int19h commented Apr 16, 2024

In C, the values in case labels are all constant expressions, so the only evaluation that needs to take place at runtime is that of the switch expression. In Python, however, every pattern actually needs to be matched against the object at runtime in sequence, as patterns can contain arbitrary expressions in them which aren't evaluated until all previous patterns failed to match. So it's fundamentally a different construct semantically even if it looks similar for simple cases.

@Real-Gecko
Copy link
Author

Currently I use following trick:

  1. Put breakpoint on match
  2. Put breakpoints right after every switch
  3. Hit F5 every time after match to "jump" to matched switch block
  4. Continue through the block with F10
    While it works it's also very inconvenient to put all those breakpoints and disable them as VSCode does not have breakpoint groups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants