microsoft / microsoft/pxt-microbit

Extra blank lines appear above the inserted JavaScript code snippet

Open
#6,413 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

monaco P3
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

Describe the bug
When the user drags a JS code snippet from the toolbox into the editor, extra blank lines appear above the inserted code.

Steps to reproduce the behavior:

  1. Navigate to https://makecode.microbit.org/beta
  2. Create a new project and switch to the JavaScript editor.
  3. Drag a code snippet from the toolbox into the editor.
  4. Observe the formatting of the inserted code.

Actual behavior
Extra blank lines appear above the inserted JavaScript code snippet.

Expected behavior
No extra blank lines appear above the inserted JavaScript code snippet.

Screen recording
Image

Additional context
1.OS: Windows 11 24H2
2.Browser: Chrome, Firefox, Edge
3.makecode.microbit.org version: 7.1.48
4.Microsoft MakeCode version: 11.4.37

More Info
1.It works fine on the Python editor.
2.It's not a regression issue, also reproduced in Live build 7.0.61

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 issue in the JavaScript editor by dragging a toolbox snippet into a new project, then trace the editor's drag-and-insert formatting path. The fix is complete when inserted JavaScript has no extra blank lines above it and Python insertion remains unaffected.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.