Does the monaco editor support the use of Typescript language service plugins?

508 Views Asked by At

I'd like to create a Typescript language service plugin (e.g. https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin) and integrate this plugin with the Monaco editor, running in a browser.

Is it possible to integrate Typescript language service plugins with Monaco?

1

There are 1 best solutions below

0
John Leidegren On

Looks like it's possible to extend the background worker. You can read all about it in this GitHub issue.

When you provide your own customTSWorkerFactory this code will be running to create your worker.

Here you can monkey patch the worker instance with any additional method that you may want to expose that does something that you couldn't do without access to the TypeScript compiler APIs (they are passed as the second argument to your customTSWorkerFactory function).

From here you should be able to accomplish anything really.