Adds a vfs project

This commit is contained in:
Orta 2020-08-31 13:09:47 -04:00
parent 89fdcf5424
commit 166e63b991
5 changed files with 117 additions and 30 deletions

View file

@ -10,6 +10,7 @@ import { IExtraLibs } from './monaco.contribution';
import IWorkerContext = monaco.worker.IWorkerContext;
export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.languages.typescript.TypeScriptWorker {
// --- model sync -----------------------
@ -36,7 +37,7 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.language
return models.concat(Object.keys(this._extraLibs));
}
private _getModel(fileName: string): monaco.worker.IMirrorModel | null {
_getModel(fileName: string): monaco.worker.IMirrorModel | null {
let models = this._ctx.getMirrorModels();
for (let i = 0; i < models.length; i++) {
if (models[i].uri.toString() === fileName) {
@ -271,7 +272,7 @@ export function create(ctx: IWorkerContext, createData: ICreateData): TypeScript
throw new Error(`The script at ${createData.customWorkerPath} does not add customTSWorkerFactory to self`)
}
// @ts-ignore - The throw validates this
TSWorkerClass = self.customTSWorkerFactory(TypeScriptWorker)
TSWorkerClass = self.customTSWorkerFactory(TypeScriptWorker, ts, libFileMap)
}
}