microsoft / microsoft/monaco-editor
[Bug] Secondary rendered Diff Editor has broken code highlighting
Open
@hediet is already working on this.
Since Dec 13, 2023.
bug
diff-editor
- 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
const container = document.getElementById('container');
const container1 = document.createElement('div');
container1.style.cssText = 'height: 50%';
container.appendChild(container1);
var diffEditor = monaco.editor.createDiffEditor(
container1,
{
renderSideBySide: false,
}
);
diffEditor.setModel({
original: monaco.editor.createModel(
`version: 2;`,
"yaml"
),
modified: monaco.editor.createModel(
"", "yaml"
),
});
setTimeout(() => {
const container2 = document.createElement('div');
container2.style.cssText = 'height: 50%';
container.appendChild(container2);
var diffEditor2 = monaco.editor.createDiffEditor(
container2,
{
renderSideBySide: false,
}
);
diffEditor2.setModel({
original: monaco.editor.createModel(
`version: 2;`,
"yaml"
),
modified: monaco.editor.createModel(
"", "yaml"
),
});
}, 1000);
Reproduction Steps
- Create two dom element containers for two diff editors
- Render diffEditor into the first container and set model
- Wait for 1s and render the second diffEditor into the second container and set similar model
Actual (Problematic) Behavior
Secondary rendered after 1s delay diff editor has broken code highlighting
Expected Behavior
All diff editors should have the same code highlighting
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.
Assessment
This issue has not been assessed yet.