Description
Bug Description
Code structure highlighting disappears in the "elif" block of an if statement.
How To Reproduce
Steps to reproduce the behavior:
- Example code: https://microbit.org/projects/make-it-code-it/magic-8ball/?editor=python
- Paste the code up until the second if statement:
- Add a few blank lines after:
- Go back to the end of the last non-empty line, press enter to go to a new line, and type "elif". It should still be highlighted at this stage:
- Press space right after the "elif":
Parsed tree (logged to Console with its toString() method) before adding the elif and pressing space:
blocks.ts:97 Script(Comment,ImportStatement(import,VariableName),WhileStatement(while,Boolean,Body(":",IfStatement(if,CallExpression(MemberExpression(VariableName,".",PropertyName),ArgList("(",String,")")),Body(":",AssignStatement(VariableName,AssignOp,CallExpression(MemberExpression(VariableName,".",PropertyName),ArgList("(",Number,",",Number,")"))),IfStatement(if,BinaryExpression(VariableName,CompareOp,Number),Body(":",ExpressionStatement(CallExpression(MemberExpression(VariableName,".",PropertyName),ArgList("(",MemberExpression(VariableName,".",PropertyName),")"))))))))))
After:
Script(Comment,ImportStatement(import,VariableName),WhileStatement(while,Boolean,Body(":",IfStatement(if,CallExpression(MemberExpression(VariableName,".",PropertyName),ArgList("(",String,")")),Body(":",AssignStatement(VariableName,AssignOp,CallExpression(MemberExpression(VariableName,".",PropertyName),ArgList("(",Number,",",Number,")"))),IfStatement(if,BinaryExpression(VariableName,CompareOp,Number),Body(":",ExpressionStatement(CallExpression(MemberExpression(VariableName,".",PropertyName),ArgList("(",MemberExpression(VariableName,".",PropertyName),")"))),⚠)),⚠)),⚠)),⚠(elif))
Expected behavior
The "elif" and what follows are meant to be highlighted as well.
Status
We simplified this a bit and raised codemirror/dev#487