diff --git a/src/checker/runtime.ts b/src/checker/runtime.ts index de2694b..403b295 100644 --- a/src/checker/runtime.ts +++ b/src/checker/runtime.ts @@ -19,7 +19,7 @@ import { import { CaseInsensitiveMap } from './fs'; import { isCaseInsensitive } from '../helpers'; - + const caseInsensitive = isCaseInsensitive(); if (!module.parent) { @@ -95,10 +95,10 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re fileName => fileName.toLowerCase() : (fileName => fileName); - let watchHost: ts.WatchCompilerHostOfFilesAndCompilerOptions; + let watchHost: ts.WatchCompilerHostOfFilesAndCompilerOptions; let watch: ts.WatchOfFilesAndCompilerOptions; - - function createWatchHost(): ts.WatchCompilerHostOfFilesAndCompilerOptions & ts.BuilderProgramHost { + + function createWatchHost(): ts.WatchCompilerHostOfFilesAndCompilerOptions & ts.BuilderProgramHost { return { rootFiles: getRootFiles(), options: compilerOptions, @@ -117,7 +117,9 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re watchFile, watchDirectory, - createHash: (...args) => compiler.sys.createHash.apply(compiler.sys, args) + createProgram: compiler.createSemanticDiagnosticsBuilderProgram, + + createHash: (...args) => compiler.sys.createHash.apply(compiler.sys, args) }; function readFile(fileName: string) { @@ -131,7 +133,7 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re function createWatch(): ts.WatchOfFilesAndCompilerOptions { watchHost = createWatchHost(); - return compiler.createWatchBuilderProgram(watchHost, compiler.createSemanticDiagnosticsBuilderProgram); + return compiler.createWatchProgram(watchHost); } function getProgram(): ts.SemanticDiagnosticsBuilderProgram { @@ -385,10 +387,10 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re replyOk(seq, { files: getProgram().getSourceFiles().map(f => f.fileName) }); - } - - function isAffectedSourceFile(affected: ts.SourceFile | ts.Program): affected is ts.SourceFile { - return (affected as ts.SourceFile).kind === compiler.SyntaxKind.SourceFile; + } + + function isAffectedSourceFile(affected: ts.SourceFile | ts.Program): affected is ts.SourceFile { + return (affected as ts.SourceFile).kind === compiler.SyntaxKind.SourceFile; } function processDiagnostics({ seq }: Diagnostics.Request) {