mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 09:20:10 +01:00
Adds monaco models for the lib d.ts files
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
This commit is contained in:
parent
1d6f5a0e24
commit
7a46ec2649
2 changed files with 8 additions and 4 deletions
|
|
@ -73,9 +73,6 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.language
|
|||
} else if (fileName in this._extraLibs) {
|
||||
// extra lib
|
||||
text = this._extraLibs[fileName].content;
|
||||
|
||||
} else if (fileName in libFileMap) {
|
||||
text = libFileMap[fileName];
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import { LanguageServiceDefaultsImpl } from './monaco.contribution';
|
||||
import { TypeScriptWorker } from './tsWorker';
|
||||
import { libFileMap } from './lib/lib'
|
||||
|
||||
import IDisposable = monaco.IDisposable;
|
||||
import Uri = monaco.Uri;
|
||||
|
|
@ -60,6 +61,12 @@ export class WorkerManager {
|
|||
|
||||
private _getClient(): Promise<TypeScriptWorker> {
|
||||
if (!this._client) {
|
||||
// Adds all of the .d.ts lib files into Monaco as editor models,
|
||||
// this allows themm to show up in peek (and allow editing if desired).
|
||||
for (const key in libFileMap) {
|
||||
monaco.editor.createModel(libFileMap[key], "ts", monaco.Uri.file(key))
|
||||
}
|
||||
|
||||
this._worker = monaco.editor.createWebWorker<TypeScriptWorker>({
|
||||
|
||||
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
||||
|
|
@ -72,7 +79,7 @@ export class WorkerManager {
|
|||
// passed in to the create() method
|
||||
createData: {
|
||||
compilerOptions: this._defaults.getCompilerOptions(),
|
||||
extraLibs: this._defaults.getExtraLibs()
|
||||
extraLibs: this._defaults.getExtraLibs(),
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue