microsoft / microsoft/monaco-editor
[Bug] Editing original model in inline diff viewer not possible even if it should be based on configuration options
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?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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