question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FR: Detect when addExtraLib is done processing / Permit bulk add/delete extra lib operations

See original GitHub issue

monaco-editor version: 0.15.6

Adding a lot of DTS files for use in JavaScript/TypeScript frequently takes several seconds for the TypeScript compiler to process. As best I can tell, there is no way to programmatically determine when the compiler has processed the extra files and is “stable” again.

The idea is that, when calling monaco.languages.typescript.LanguageServiceDefaults.addExtraLib with large DTS files, it would be helpful to show the user an indeterminate progress bar to make it clear that autocompletions are not available presently. Notifying the program that processing is complete could be accomplished via an event, a promise returned from addExtraLib, or an optional callback to addExtraLib.

Note, if addExtraLib is called multiple times in quick succession, we would want to know when the TypeScript compiler has finished processing all of the DTS files, not only/just a single DTS file.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
stefan-lacatuscommented, Feb 4, 2019

I’ll try to create a PR with this features this week. As far as I know, there’s no existing issue for this.

1reaction
stefan-lacatuscommented, Feb 4, 2019

From my experience, the reason for the delay is not the processing delay, but rather inefficient handling of extraLibs in monaco-typescript. As it is right now, in the official monaco-typescript release, whenever addExtraLib is called the existing worker is destroyed, the extra lib is added, then a new one is initialized with all the libs. The same process happens when a extra lib is disposed of. So, whenever you call addExtraLib you are destroying all parsing, and creating it again for all the inmemory editors and extra libs. In my fork, I’ve fixed this issue by passing making the main thread pass the new extra libs over to the WebWorker on demand, without destroying it. The bulk of the work is here: https://github.com/stefan-lacatus/monaco-typescript/commit/9d9675a28ffc039ec471c4bb240758f81720f84b . The linked commit also deals with bulk updates of the extraLibs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use addExtraLib in Monaco with an external type ...
After playing around a little I found a solution. Basically, the file has to be loaded using createModel with an explicit file URL....
Read more >
LanguageServiceDefaults | Monaco Editor API
Remove all existing extra libs and set the additional source files to the language service. Use this for typescript definition files that won't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found