Add back getSourceFile and mark it as deprecated

This commit is contained in:
Mohamed Hegazy
2016-09-19 11:51:01 -07:00
parent b7d1d11ba3
commit af5148d4f3
4 changed files with 18 additions and 0 deletions

View File

@@ -492,6 +492,9 @@ namespace Harness.LanguageService {
getNonBoundSourceFile(fileName: string): ts.SourceFile {
throw new Error("SourceFile can not be marshaled across the shim layer.");
}
getSourceFile(fileName: string): ts.SourceFile {
throw new Error("SourceFile can not be marshaled across the shim layer.");
}
dispose(): void { this.shim.dispose({}); }
}

View File

@@ -678,6 +678,10 @@ namespace ts.server {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}
getSourceFile(fileName: string): SourceFile {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}
cleanupSemanticCache(): void {
throw new Error("cleanupSemanticCache is not available through the server layer.");
}

View File

@@ -1401,6 +1401,10 @@ namespace ts {
return syntaxTreeCache.getCurrentSourceFile(fileName);
}
function getSourceFile(fileName: string): SourceFile {
return getNonBoundSourceFile(fileName);
}
function getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan {
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
@@ -1812,6 +1816,7 @@ namespace ts {
isValidBraceCompletionAtPosition,
getEmitOutput,
getNonBoundSourceFile,
getSourceFile,
getProgram
};
}

View File

@@ -240,6 +240,12 @@ namespace ts {
/* @internal */ getNonBoundSourceFile(fileName: string): SourceFile;
/**
* @internal
* @deprecated Use ts.createSourceFile instead.
*/
getSourceFile(fileName: string): SourceFile;
dispose(): void;
}