Fix the crash in getCompilerOptionsDiagnostics by not using file name as compiler options do not have file name

Fixes #988
This commit is contained in:
Sheetal Nandi 2014-11-06 19:00:44 -08:00
parent 8ab038f1a3
commit 28fa6029eb

View File

@ -507,17 +507,6 @@ module ts {
};
}
private realizeDiagnosticWithFileName(diagnostic: Diagnostic): { fileName: string; message: string; start: number; length: number; category: string; } {
return {
fileName: diagnostic.file.filename,
message: diagnostic.messageText,
start: diagnostic.start,
length: diagnostic.length,
/// TODO: no need for the tolowerCase call
category: DiagnosticCategory[diagnostic.category].toLowerCase()
};
}
public getSyntacticClassifications(fileName: string, start: number, length: number): string {
return this.forwardJSONCall(
"getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")",
@ -559,7 +548,7 @@ module ts {
"getCompilerOptionsDiagnostics()",
() => {
var errors = this.languageService.getCompilerOptionsDiagnostics();
return errors.map(d => this.realizeDiagnosticWithFileName(d))
return errors.map(LanguageServiceShimObject.realizeDiagnostic)
});
}