microsoft / microsoft/pxt-microbit

Inline comments are ignored in Python when returning to blocks

Open
#4,260 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

comments decompiler python
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

Describe the bug
There appears to be a difference in behaviour when someone tries to use inline comments in Python and switch to blocks and back. Not sure what the default behaviour is supposed to be.

It seems that when someone adds an inline comment in Python and switches to blocks and back, the comment is ignored. If the comment is added on a new line it is included as part of the block for the code below it.

In Javascript, a line-level comment appears to be moved to a new line when you switch to blocks and then remains on that line when y

To Reproduce

https://user-images.githubusercontent.com/31242877/124438342-f6ffce00-dd6f-11eb-8bb0-8d0026d5bb4f.mp4

Expected behavior
I would expect that if I added a comment at the end of a line, that it would stay there when I switch between languages

Desktop (please complete the following information):

  • OS: [e.g. iOS] Mac
  • Browser [e.g. chrome, safari] Firefox
  • Version [e.g. 22] 89

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior shown in the linked video by adding an inline Python comment, switching to blocks, and switching back. Start by tracing the editor's Python-to-blocks and blocks-to-Python conversion paths; done means an end-of-line comment remains attached to its original line, including when switching languages repeatedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.