microsoft / microsoft/monaco-editor

[Bug] Editing original model in inline diff viewer not possible even if it should be based on configuration options

Open
#5,302 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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#XQAAAAJjAgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw1ywOc3g3TZokiQe3t547J-9ebB9cYURQV2C_HyzmFKq-zHr7CL5opGlpi_AOvKvzZ3i3ITvDrqy_CgWLe8nzPfRcjGsigwE9_J2qOtPn88pmhu9_yKIbFcbbOldJxbsZ9LkVEh_hzRCzlJWgqN9MOF72YHODV1uZEj0HtZq3JRXxYNUUXVYqGIDguR07WhPWmy4POSvcvO4BR2YcCzfmfK5ZDnxw2Fbf91l4zAyMZHYEiY5QdFX4EoNu8IIpxG26RVpzI0DTeg-y9ZJdmFRQ2WtKP9Z-dTEyLOkyISB0vZeBBTroraw10xURz68D9vhkg3m0pjN7m8l0LPLIm1ulGWNVRVw2of6eexD9nI1XRacX_3t1zgA

Monaco Editor Playground Code
var originalModel = monaco.editor.createModel(
	"This line is removed on the right.\njust some text\nabcd\nefgh\nSome more text",
	"text/plain"
);

var modifiedModel = monaco.editor.createModel(
	"just some text\nabcz\nzzzzefgh\nSome more text\nThis line is removed on the left.",
	"text/plain"
);

var diffEditor = monaco.editor.createDiffEditor(
	document.getElementById("container"),
	{
		renderSideBySide: false,
		originalEditable: true,
		readOnly: true, // Can be either true or false
	}
);

diffEditor.setModel({
	original: originalModel,
	modified: modifiedModel,
});
Reproduction Steps

With the code above, attempt to edit the original model in the diff editor.

Actual (Problematic) Behavior

The original model is not editable in an inline diff editor even though originalEditable is true. If the diff editor wasn't inline, the original model would be editable.

Expected Behavior

The original model should be editable.

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

Start with the Monaco Editor Playground link and the provided TypeScript reproduction, focusing on createDiffEditor options for inline mode, originalEditable, and readOnly. Confirm the behavior with the supplied models, then make the original model editable in inline diff mode when originalEditable is true and verify that readOnly still controls the expected editing behavior.

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
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.