From 68fd9f8d4085f1782c074ffd76d361ce9c0a8355 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Fri, 6 Feb 2015 14:20:29 -0800 Subject: [PATCH 1/2] Shim API changes to enable existing installations of VS to use the latest master builds --- src/services/services.ts | 2 +- src/services/shims.ts | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index fad7632843aaa..fcb5c696a38cf 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -10,7 +10,7 @@ module ts { - export var servicesVersion = "0.5" + export var servicesVersion = "0.4" export interface Node { getSourceFile(): SourceFile; diff --git a/src/services/shims.ts b/src/services/shims.ts index 5b5216813fe40..107432af1f179 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -204,6 +204,8 @@ module ts { } export class LanguageServiceShimHostAdapter implements LanguageServiceHost { + private files: string[]; + constructor(private shimHost: LanguageServiceShimHost) { } @@ -230,10 +232,15 @@ module ts { public getScriptFileNames(): string[] { var encoded = this.shimHost.getScriptFileNames(); - return JSON.parse(encoded); + return this.files = JSON.parse(encoded); } public getScriptSnapshot(fileName: string): IScriptSnapshot { + // Shim the API changes for 1.5 release. This should be removed once + // TypeScript 1.5 has shipped. + if (this.files && this.files.indexOf(fileName) < 0) { + return undefined; + } var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); } @@ -266,7 +273,10 @@ module ts { } public getDefaultLibFileName(options: CompilerOptions): string { - return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + // Shim the API changes for 1.5 release. This should be removed once + // TypeScript 1.5 has shipped. + return ""; + //return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); } } @@ -662,6 +672,7 @@ module ts { "getEmitOutput('" + fileName + "')", () => { var output = this.languageService.getEmitOutput(fileName); + (output).emitOutputStatus = output.emitSkipped ? 1 : 0; return output; }); } From 0f3f2bcb566f5353da313c8c641dd2b2ce99e91e Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Fri, 6 Feb 2015 14:22:32 -0800 Subject: [PATCH 2/2] add comment --- src/services/shims.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/services/shims.ts b/src/services/shims.ts index 107432af1f179..759c1078d90fa 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -672,6 +672,8 @@ module ts { "getEmitOutput('" + fileName + "')", () => { var output = this.languageService.getEmitOutput(fileName); + // Shim the API changes for 1.5 release. This should be removed once + // TypeScript 1.5 has shipped. (output).emitOutputStatus = output.emitSkipped ? 1 : 0; return output; });