microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
710 stars 589 forks source link

Python basic.show_leds() indents the string incorrectly #4665

Closed microbit-carlos closed 1 year ago

microbit-carlos commented 2 years ago

https://support.microbit.org/a/tickets/53675 (private)

Describe the bug In the Python code editor, the basic.show_leds() string argument is not aligned correctly. This is not an issue with the JavaScript code view.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://makecode.microbit.org
  2. Drop the "show LEDs" block
  3. Switch to Python code
  4. See the string alignment:
basic.show_leds("""
    # . . . .
        # . . . .
        # . . . .
        # . . . .
        # . . . .
""")

Expected behavior Each line of the string to have the same indentation.

Screenshots

image image

micro:bit version (please complete the following information):

N/A

Desktop (please complete the following information):

Smartphone (please complete the following information): N/A

Additional context

makecode.microbit.org version: 4.0.18

Microsoft MakeCode version: 7.0.14

microbit runtime version: v2.2.0-rc6

codal-microbit-v2 runtime version: v0.2.32

microbit-carlos commented 2 years ago

This is somewhat related to https://github.com/microsoft/pxt-microbit/issues/3116, but the misalignment is not the same.

abchatra commented 1 year ago

I can reproduce this. The indentation differs in intelligence and when you go to blocks and back. Ideally it should be consistent.

abchatra commented 1 year ago

Likely fix in blocks->text compiler and the pyhon intelliense

abchatra commented 1 year ago

Also evaluate moving to pyright intellisense instead of our own. https://github.com/microsoft/pyright

jwunderl commented 1 year ago

closing as dup of https://github.com/microsoft/pxt-microbit/issues/4891 (this one was filed first, but the other one has a few more samples with it being extra bad & @benvillalobos already assigned himself that one~)