microsoft / microsoft/monaco-editor

addExtraLib() method is adding the library to all editor available in a page

Open
#2,098 8 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request typescript
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

I am building a page that contains multiple monaco editors. I want to add instance specific libraries.
I have used addExtraLib() api to add libraries using:

monaco.languages.typescript.LanguageServiceDefaults.addExtraLib(content, filePath);

By this all editors are forced to have exactly the same libraries available across all editors in a page. I understand that anything which is configured via monaco.languages are defined globally. Is there any api through which I can update a library to a specific instance and not globally?

monaco-editor version: v0.20.0
Browser: Chrome
OS: macOS High Sierra

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 at monaco.languages.typescript.LanguageServiceDefaults.addExtraLib(content, filePath) and review the editor instance configuration entry points. Determine whether extra libraries can be scoped to one editor; done means the supported per-instance behavior, or the documented limitation, is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.