microsoft / microsoft/monaco-editor
[Bug] DiffEditor shows overloads because of duplicated definitions
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
Monaco Editor Playground Code
var originalModel = monaco.editor.createModel('function foo() {}', 'javascript');
var modifiedModel = monaco.editor.createModel('function foo() {}', 'javascript');
var diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'));
diffEditor.setModel({
original: originalModel,
modified: modifiedModel
});
Actual Behavior
Editor shows two definitions for function

Resulting in a +1 overload

Expected Behavior
I would expect just one definition. The definition, referencing a function in the same file should depend on the model I am currently looking at.
Additional Context
We are using the DiffEditor to compare changes to a file since it has been saved the last time, thus the two models refer to the same file in different states. Cross referencing functions between the two models does not make sense for our use case and is kind of irritating.
Is there an option to deactivate it, or are we entirely on the wrong track?
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 reproduction using monaco.editor.createModel, monaco.editor.createDiffEditor, and diffEditor.setModel. Trace how definitions are resolved across the original and modified models, then check whether an existing option controls this behavior. Done means the same-file DiffEditor case shows one definition without breaking cross-file references.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100