microsoft / microsoft/monaco-editor

[Bug] DiffEditor: word wrap stops working on the left side after switching from inline to side-by-side view

Open
#5,353 0 comments 0 reactions 1 assignee View on GitHub

@hediet is already working on this.

Since Jun 10, 2026.

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.55.1#XQAAAAJ4BQAAAAAAAABBqQkHQ5Njdzm5yR4Lw6XVLunIMccRY1GLFk5suhm1pa527sxodU_8WXaCaltxD94ddtrnVYjnl9BAIsTnEzuhLgyS-QLrooP5zGSe_u1QAh8m56yijBKSqkbu7Pn2rencNOOF5cPbgUASbzBN4CHlGxObjyvxSxGv5t6bIU878VJ9B_ulw7o7PxLPoRGKZEdbnv3mplZW1Wr5Nx5tf8igS-RVp4o3VG_iF4pFz9_A8iAzT_B5RU4J8L2j-xkeUNiBvwnUHnVqLqkeD74-HmrGO6g03ESGggYwmSvpAUa-YTZUE4U2ELIQz9ChqvpRxjVldBkGsTCWg2ozrt7dnpNoKR0jFVAoonsWDdungGEKSRxbrzCdYxCpB4sdpA-LKSp2Z6Yh-0Gn24h1Cux1ovkRQvqaH280Au7fF-uytb3lnf6FPO2t1gqkpgNF5oJjDdKsVDt9ZZ5OAdHtxdd4rwSI6vD15w6fwxV4MBKMKMN2DhZaWDHe-aFLy_csndUknG5sYsGQ4PBkxAzrbdCeE2DvOsJHwMovf1RiC20I7Yg8xCb8SUGPxGfPB7BXnTWDJ-sd4z-iCbW8farjN1_bWu9rdstOrdtqR9xbnCBAzFXty9fKPyuV3lwiUlp4oAQJj7AfQcwXU6XxGpPYPMrr0fySNtfPPmZRM-1m0g-88Z6FnjVvrcO-lWpXy4GHz8HSJKCRHgZhdLhVBeKWjAt52vKolqlUEjjsvxqVguGDleR8NI9top7DriUiPpj5jR0b7d4brH0cTxKf_NqJkCDquEXOsD69f_8xGNsRhzz_z0VVDEiqzirEaUhz5PaWL230ZbFPDTDR8tGPAZZBjBLE74m7Pr3fQ6k3SzgY9M_8vDBogE5LDPdxxaMo2ip9Cs4-wSQd7oJ2iPPq5YRr07wP0p-Xsk905caE7lqIkHu_Hh7MeXXl3yNO0i7keQUscCryuSpSpQn_6zLNBQ

Monaco Editor Playground Code
const LONG_LINE = `"message": "This is a deliberately long line that should word-wrap at the viewport edge when wordWrap is on, but will not wrap on the original (left) side after switching from inline to side-by-side view due to a Monaco bug"`;

const originalModel = monaco.editor.createModel(
    `{\n  ${LONG_LINE},\n  "status": "ok"\n}`,
    'json'
);
const modifiedModel = monaco.editor.createModel(
    `{\n  ${LONG_LINE},\n  "status": "error"\n}`,
    'json'
);

const diffEditor = monaco.editor.createDiffEditor(
    document.getElementById("container"),
    {
        renderSideBySide: false,
        wordWrap: 'on',
        diffWordWrap: 'on',
        automaticLayout: true,
    }
);
diffEditor.setModel({ original: originalModel, modified: modifiedModel });

document.getElementById("switch-btn").addEventListener("click", () => {
    diffEditor.updateOptions({ renderSideBySide: true });
    document.getElementById("note").textContent =
        "Side-by-side view: left (original) does NOT wrap ❌ — right (modified) wraps ✓";
});

<button id="switch-btn" style="margin: 8px 0; padding: 6px 14px; cursor: pointer">
    Switch to side-by-side view
</button>
<p id="note" style="margin: 4px 0 8px; font-size: 12px; color: #555">
    Currently: inline view. Click the button — word wrap will break on the left.
</p>
<div id="container" style="height: 80%"></div>
Reproduction Steps
  • Go to the Playground
  • Click on Switch to side-by-side view button
Actual (Problematic) Behavior

Observe that the left editor doesn't have word wrapping on:
Image

Expected Behavior

Left editor should have word wrapping

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.