Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t try to recreate AutoImportProvider after giving up because of too many dependencies until program structure changes #59692

Conversation

andrewbranch
Copy link
Member

I noticed the following sequence in a TS Server log:

Info 1254 [11:44:16.297] getCompletionsAtPosition: isCompletionListBlocker: 0.037459000002854737
Info 1255 [11:44:16.328] AutoImportProviderProject: attempted to add more than 10 dependencies. Aborting.
Info 1256 [11:44:16.328] getExportInfoMap: cache miss or empty; calculating new results
Info 1257 [11:44:16.399] AutoImportProviderProject: attempted to add more than 10 dependencies. Aborting.
Info 1258 [11:44:16.399] getExportInfoMap: done in 97.71966699999757 ms
Info 1259 [11:44:16.403] AutoImportProviderProject: attempted to add more than 10 dependencies. Aborting.

host.getPackageJsonAutoImportProvider() gets called multiple times during completions. When an AutoImportProvider program exists, it’s cached and updated appropriately. But when one fails to be created because either it finds no dependencies or too many dependencies, the result of that failure wasn’t being stored; instead, we tried to recreate it every time we attempt to get it from the host.

View commit d44feec in isolation to see the desired effect in the server logs.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 19, 2024
src/server/project.ts Outdated Show resolved Hide resolved
@andrewbranch andrewbranch merged commit 7f597be into microsoft:main Aug 21, 2024
32 checks passed
@andrewbranch andrewbranch deleted the bug/auto-import-provider-duplicate-creation-attempts branch August 21, 2024 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants