Shim API changes to enable existing installations of VS to use the latest master builds

This commit is contained in:
Mohamed Hegazy
2015-02-06 14:20:29 -08:00
parent 369f784cfa
commit 68fd9f8d40
2 changed files with 14 additions and 3 deletions

View File

@@ -10,7 +10,7 @@
module ts {
export var servicesVersion = "0.5"
export var servicesVersion = "0.4"
export interface Node {
getSourceFile(): SourceFile;

View File

@@ -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);
(<any>output).emitOutputStatus = output.emitSkipped ? 1 : 0;
return output;
});
}