mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 12:45:39 +01:00
Clear the file fields of relatedInformation too.
This commit is contained in:
parent
c7b54325fd
commit
2d6f48ee53
1 changed files with 16 additions and 3 deletions
|
|
@ -121,21 +121,34 @@ export class TypeScriptWorker implements ts.LanguageServiceHost {
|
||||||
|
|
||||||
// --- language features
|
// --- language features
|
||||||
|
|
||||||
|
private static clearFiles(diagnostics: ts.Diagnostic[]) {
|
||||||
|
// Clear the `file` field, which cannot be JSON'yfied because it
|
||||||
|
// contains cyclic data structures.
|
||||||
|
diagnostics.forEach(diag => {
|
||||||
|
diag.file = undefined;
|
||||||
|
// FIXME: What is the procedure to upgrade the TypeScript typings?
|
||||||
|
const related = <ts.Diagnostic[]>(<any>diag).relatedInformation;
|
||||||
|
if (related) {
|
||||||
|
related.forEach(diag2 => diag2.file = undefined);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getSyntacticDiagnostics(fileName: string): Promise<ts.Diagnostic[]> {
|
getSyntacticDiagnostics(fileName: string): Promise<ts.Diagnostic[]> {
|
||||||
const diagnostics = this._languageService.getSyntacticDiagnostics(fileName);
|
const diagnostics = this._languageService.getSyntacticDiagnostics(fileName);
|
||||||
diagnostics.forEach(diag => diag.file = undefined); // diag.file cannot be JSON'yfied
|
TypeScriptWorker.clearFiles(diagnostics);
|
||||||
return Promise.as(diagnostics);
|
return Promise.as(diagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSemanticDiagnostics(fileName: string): Promise<ts.Diagnostic[]> {
|
getSemanticDiagnostics(fileName: string): Promise<ts.Diagnostic[]> {
|
||||||
const diagnostics = this._languageService.getSemanticDiagnostics(fileName);
|
const diagnostics = this._languageService.getSemanticDiagnostics(fileName);
|
||||||
diagnostics.forEach(diag => diag.file = undefined); // diag.file cannot be JSON'yfied
|
TypeScriptWorker.clearFiles(diagnostics);
|
||||||
return Promise.as(diagnostics);
|
return Promise.as(diagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCompilerOptionsDiagnostics(fileName: string): Promise<ts.Diagnostic[]> {
|
getCompilerOptionsDiagnostics(fileName: string): Promise<ts.Diagnostic[]> {
|
||||||
const diagnostics = this._languageService.getCompilerOptionsDiagnostics();
|
const diagnostics = this._languageService.getCompilerOptionsDiagnostics();
|
||||||
diagnostics.forEach(diag => diag.file = undefined); // diag.file cannot be JSON'yfied
|
TypeScriptWorker.clearFiles(diagnostics);
|
||||||
return Promise.as(diagnostics);
|
return Promise.as(diagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue