mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 19:42:56 +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) {
|
} else if (fileName in this._extraLibs) {
|
||||||
// extra lib
|
// extra lib
|
||||||
text = this._extraLibs[fileName].content;
|
text = this._extraLibs[fileName].content;
|
||||||
|
|
||||||
} else if (fileName in libFileMap) {
|
|
||||||
text = libFileMap[fileName];
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
import { LanguageServiceDefaultsImpl } from './monaco.contribution';
|
import { LanguageServiceDefaultsImpl } from './monaco.contribution';
|
||||||
import { TypeScriptWorker } from './tsWorker';
|
import { TypeScriptWorker } from './tsWorker';
|
||||||
|
import { libFileMap } from './lib/lib'
|
||||||
|
|
||||||
import IDisposable = monaco.IDisposable;
|
import IDisposable = monaco.IDisposable;
|
||||||
import Uri = monaco.Uri;
|
import Uri = monaco.Uri;
|
||||||
|
|
@ -60,6 +61,12 @@ export class WorkerManager {
|
||||||
|
|
||||||
private _getClient(): Promise<TypeScriptWorker> {
|
private _getClient(): Promise<TypeScriptWorker> {
|
||||||
if (!this._client) {
|
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>({
|
this._worker = monaco.editor.createWebWorker<TypeScriptWorker>({
|
||||||
|
|
||||||
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
||||||
|
|
@ -72,7 +79,7 @@ export class WorkerManager {
|
||||||
// passed in to the create() method
|
// passed in to the create() method
|
||||||
createData: {
|
createData: {
|
||||||
compilerOptions: this._defaults.getCompilerOptions(),
|
compilerOptions: this._defaults.getCompilerOptions(),
|
||||||
extraLibs: this._defaults.getExtraLibs()
|
extraLibs: this._defaults.getExtraLibs(),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue