It seems the Python parser does not correctly handle for/else loops and while/else loops, particularly with respect to indentation in nested blocks.
Admittedly, I myself only just found this out but turns out an else clause in a while or for loop is valid Python code (see docs and examples) so I believe the Python parser should handle it appropriately and indent else clauses the same as it does with a matching if statement.
Describe the issue
It seems the Python parser does not correctly handle for/else loops and while/else loops, particularly with respect to indentation in nested blocks.
Admittedly, I myself only just found this out but turns out an
else
clause in awhile
orfor
loop is valid Python code (see docs and examples) so I believe the Python parser should handle it appropriately and indentelse
clauses the same as it does with a matchingif
statement.See repro gif below to showcase what I mean:
Browser and platform
latest MacOS, Firefox (but should repro in all)
Reproduction link
https://replit.com/@SergeiChestakov/cm-py-indentation-bug