microsoft / microsoft/monaco-editor

[Bug] Placeholder doesn't display whitespaces

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

Nobody has claimed this yet.

bug confirmed editor-rendering
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.51.0-rc3#XQAAAAJrAQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscwzcqiW_1uhs0-3YGTBOsVJ4S4FwfCDQb5-2uUHXTVAefbVSd9IzaZ_vv9VR9KugsKimARHSWlrTPOQHROITHxmAetfeRrm3VHdSe7_Etv6WpgzlH4vE8EOEEwk8H8IFxSmzgqwKQpjOsq0VT9OkSPNBU_af_MQo3128-5xBdX2FQesVrxFyKhiY0ZA2W4TXnVmqpqPvxJJYtioxwHrgSXJT1rfncR_EOpciKnCmE4R9ASUJPJ0uTqqD0ZWkK9-HadWyUxsA0eTSATGuR1TkAtY5PxnB1I8xb6VVXe5jTQi05wpe21Lv_gsiN6

Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `function hello() {
	alert('Hello world!');
}`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	placeholder: value,
	language: "javascript",
	automaticLayout: true,
});
Reproduction Steps

No response

Actual (Problematic) Behavior

The second line of the placeholder is aligned to the left

Expected Behavior

The code should be properly formatted

Additional Context

No response

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

Open the linked Monaco Editor Playground and run the supplied TypeScript example to reproduce the placeholder alignment problem. Trace the placeholder rendering behavior from the playground setup; done means whitespace and indentation in the multiline placeholder are preserved so the second line is properly aligned.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.