microbit-foundation / python-editor-v3

Micro:bit Educational Foundation Python Editor V3
https://python.microbit.org
MIT License
60 stars 37 forks source link

[Code structure] Special case new blocks #202

Open microbit-matt-hillsdon opened 3 years ago

microbit-matt-hillsdon commented 3 years ago

New blocks are generally invalid code at this point:

image

but it would be useful to highlight the indented part of the blank line to indicate where the new code should go.

There's probably enough information in the parse tree to do a good job of this. Worth a try at least.

microbit-matt-hillsdon commented 3 years ago

We should perhaps just consider not trimming trailing whitespace down to the cursor when it’s clear the block isn’t complete (e.g. no trailing return/raise/continue/break). Needs some experimentation.