refactor(language-service): remove unnecessary size check (#32587)
Presumably, the size of the results array was checked so that a TS source file wouldn't have to be created if there were no diagnostics. However, it is very likely that a TS program already has the `ts.SourceFile` for file when diagnostics are queried. This removal is just to make the function a minimal amount simpler. PR Close #32587
This commit is contained in:
parent
d30cd3309b
commit
b6f439d91b
|
@ -49,9 +49,6 @@ class LanguageServiceImpl implements LanguageService {
|
||||||
if (declarations && declarations.length) {
|
if (declarations && declarations.length) {
|
||||||
results.push(...getDeclarationDiagnostics(declarations, analyzedModules));
|
results.push(...getDeclarationDiagnostics(declarations, analyzedModules));
|
||||||
}
|
}
|
||||||
if (!results.length) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const sourceFile = fileName.endsWith('.ts') ? this.host.getSourceFile(fileName) : undefined;
|
const sourceFile = fileName.endsWith('.ts') ? this.host.getSourceFile(fileName) : undefined;
|
||||||
return uniqueBySpan(results).map(d => ngDiagnosticToTsDiagnostic(d, sourceFile));
|
return uniqueBySpan(results).map(d => ngDiagnosticToTsDiagnostic(d, sourceFile));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue