microsoft / microsoft/monaco-editor
[Bug] Duplicated function in intellisense after `addExtraLib`
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
// The Monaco Editor can be easily created, given an
// empty container and an options literal.
// Two members of the literal are "value" and "language".
// The editor takes the full size of its container.
monaco.editor.create(document.getElementById("container"), {
value: "function hello() {\n\talert('Hello world!');\ntrim()}",
language: "typescript",
});
monaco.languages.typescript.typescriptDefaults.addExtraLib(
'function trim(s: string):string;',
'index.d.ts',
);
Reproduction Steps
hover over trim function in Preview pane.
Tooltip will be shown: 'function trim(s: string): string (+1 overload)'

(+1 overload) is not expected (since I only defined a single trim function).
Similar thing happens if I type trim( to see autocompletion. It shows like there are 2 overloads of trim function, while actually there's only one.

Actual (Problematic) Behavior
editor behaves like addExtraLib is called twice and shows 2 identical overloads of a function defined in addExtraLib
Expected Behavior
I'd expect a single overload of trim function to exist in autocomplete.
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
Run the Monaco Editor Playground reproduction from the linked URL and inspect the typescriptDefaults.addExtraLib path and its intellisense behavior for the trim declaration. Compare hover and autocomplete results before and after addExtraLib; done means the single declared function no longer appears as two identical overloads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100