perf(language-service): improve Language service performance (#32098)
PR Close #32098
This commit is contained in:
parent
fca3e79415
commit
65297cde19
@ -273,13 +273,7 @@ export class StaticSymbolResolver {
|
|||||||
// Note: Some users use libraries that were not compiled with ngc, i.e. they don't
|
// Note: Some users use libraries that were not compiled with ngc, i.e. they don't
|
||||||
// have summaries, only .d.ts files, but `summaryResolver.isLibraryFile` returns true.
|
// have summaries, only .d.ts files, but `summaryResolver.isLibraryFile` returns true.
|
||||||
this._createSymbolsOf(filePath);
|
this._createSymbolsOf(filePath);
|
||||||
const metadataSymbols: StaticSymbol[] = [];
|
return this.symbolFromFile.get(filePath) || [];
|
||||||
this.resolvedSymbols.forEach((resolvedSymbol) => {
|
|
||||||
if (resolvedSymbol.symbol.filePath === filePath) {
|
|
||||||
metadataSymbols.push(resolvedSymbol.symbol);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return metadataSymbols;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createSymbolsOf(filePath: string) {
|
private _createSymbolsOf(filePath: string) {
|
||||||
@ -363,9 +357,12 @@ export class StaticSymbolResolver {
|
|||||||
this.createResolvedSymbol(symbol, filePath, topLevelSymbolNames, symbolMeta));
|
this.createResolvedSymbol(symbol, filePath, topLevelSymbolNames, symbolMeta));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
resolvedSymbols.forEach(
|
const uniqueSymbols = new Set<StaticSymbol>();
|
||||||
(resolvedSymbol) => this.resolvedSymbols.set(resolvedSymbol.symbol, resolvedSymbol));
|
for (const resolvedSymbol of resolvedSymbols) {
|
||||||
this.symbolFromFile.set(filePath, resolvedSymbols.map(resolvedSymbol => resolvedSymbol.symbol));
|
this.resolvedSymbols.set(resolvedSymbol.symbol, resolvedSymbol);
|
||||||
|
uniqueSymbols.add(resolvedSymbol.symbol);
|
||||||
|
}
|
||||||
|
this.symbolFromFile.set(filePath, Array.from(uniqueSymbols));
|
||||||
}
|
}
|
||||||
|
|
||||||
private createResolvedSymbol(
|
private createResolvedSymbol(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user