You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto-import consistently failing after a few minutes (happening in vscode, nightly ts) #48880
I'm sorry, this may not be a very good bug report, but auto-import consistently stops working after a few minutes. I have posted a bit of logging below.
🔎 Search Terms
Auto-import crashes, Auto import failing, Auto import broken
🕗 Version & Regression Information
None of these are applicable. I am using typescript nightly in vscode, and it has happened on an off for a long time.
🙁 Actual behavior
After a few minutes of work, auto importing stops working. If restart the tsserver in vscode the auto imports work again on the same line of code. This happens repeatedly after 10-15 minutes of coding. Even when importing the same thing in a different file. I noticed this in this logs:
Info 737 [14:16:50.020] getCompletionData: Get current token: 0.011509895324707031
Info 738 [14:16:50.020] getCompletionData: Is inside comment: 0.0037658214569091797
Info 739 [14:16:50.020] getCompletionData: Get previous token: 0.04294610023498535
Info 740 [14:16:50.020] getCompletionsAtPosition: isCompletionListBlocker: 0.01444697380065918
Info 741 [14:16:50.025] AutoImportProviderProject: attempted to add more than 10 dependencies. Aborting.
Info 742 [14:16:50.026] getExportInfoMap: cache hit
Info 743 [14:16:50.027] AutoImportProviderProject: attempted to add more than 10 dependencies. Aborting.
Info 744 [14:16:50.034] collectAutoImports: resolved 0 module specifiers, plus 0 ambient and 0 from cache
Info 745 [14:16:50.034] collectAutoImports: response is complete
Info 746 [14:16:50.034] collectAutoImports: 6.69482684135437
Info 747 [14:16:50.034] getCompletionData: Semantic work: 14.261340141296387
Info 748 [14:16:50.045] getCompletionsAtPosition: getCompletionEntriesFromSymbols: 11.098047971725464
As you can see, it does find results attempted to add more than 10 dependencies, but then it bails out with no suggestions in the vscode intellisense dropdown.
changed the title [-]Auto-import constantly failing after a few minutes (happening in vscode, nightly ts)[/-][+]Auto-import consistently failing after a few minutes (happening in vscode, nightly ts)[/+]on Apr 28, 2022
Here are TSServer logs of an auto import failure: fail-autoimport.zip
(look for getTypedLayerDe\b near the end)
And the same auto completion after a restart: success-autoimport.zip
There’s no error in the logs, so unfortunately it doesn’t give me anything to go on. This isn’t going to be actionable without either (a) a way I can reproduce the issue on my own machine, or (b) hopping on a call and LiveShare debugging a repro on your machine.
I'm not sure I can put together a reproducible case, since I don't have a clear pattern and inside a very large project. I can provide a bit more info: it just happened when I had two files open in vscode. Intellisense brought up the appropriate import on one file, which I then inserted and saved. Then I switch to the other open file, and it couldn't find anything. The import was relative to both files' locations, with the same depth of directory traversal. I'm definitely down for a liveshare, if that would help. It happens enough that we should be able to trigger it.
And to clarify, once it can’t find the auto-import, you restarted TS Server without changing anything else and then it appeared? There are lots of reasons why an auto-import might not show up, but if you can fix it just by restarting the server it’s definitely a bug.
And to clarify, once it can’t find the auto-import, you restarted TS Server without changing anything else and then it appeared? There are lots of reasons why an auto-import might not show up, but if you can fix it just by restarting the server it’s definitely a bug.
Yep, just restarting the server and triggering the exact same completion at the same spot is enough to fix the issue.
And to clarify, once it can’t find the auto-import, you restarted TS Server without changing anything else and then it appeared? There are lots of reasons why an auto-import might not show up, but if you can fix it just by restarting the server it’s definitely a bug.
Yep, just restarted ts server and boom, it popped up
Next time that happens, instead of restarting the server, can you try going to a different file in the same tsconfig.json project (this won’t work if you go to a file in another composite project), trigger completions there (in a way that gets auto-imports, i.e. not a property access), and then go back to the original file and try again?
Jared A. Scheel (@jscheel) if my hypothesis and fix at #48979 is correct, you’ll see a response that looks something like {"seq":0,"type":"response","command":"completionInfo","request_seq":290,"success":true,"performanceData":{"updateGraphDurationMs":48.1666110008955},"body":{"canceled":true}} in your TS Server log shortly before things go off the rails.
In ~11 hours you’ll be able to try typescript@4.7.0-dev.20220506 and I expect that should do better. Let me know if not. Thanks for answering a million questions!
On Wed, May 4, 2022 at 4:04 PM Andrew Branch ***@***.***> wrote:
Next time that happens, instead of restarting the server, can you try
going to a different file in the same tsconfig.json project (this won’t
work if you go to a file in another composite project), trigger completions
there (in a way that gets auto-imports, i.e. not a property access), and
then go back to the original file and try again?
—
Reply to this email directly, view it on GitHub
<#48880 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABTUFSNGAFVRYMHMC7RDHDVILQ5ZANCNFSM5UTVAXBA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
Hi! I've been having trouble with autocomplete lately and I've stumbled upon this thread, which is the only one that pops up when looking for "AutoImportProviderProject: attempted to add more than" besides the code itself xD
The thing is, I was having trouble with autocomplete in a new project with lots of dependencies, and I tried going into the code and changing the hardcoded maxDependencies from 10 to 100, which solved the problem at the cost of extremely poor performance and constant process kills (which is to be expected).
I checked a different project in which autocomplete works well, and I see that it's loading 6 dependencies. I don't quite understand what might be happening here, I expect the ts server to work under any amount of dependencies.
I feel like there is something here I'm not understanding correclty
Activity
[-]Auto-import constantly failing after a few minutes (happening in vscode, nightly ts)[/-][+]Auto-import consistently failing after a few minutes (happening in vscode, nightly ts)[/+]andrewbranch commentedon Apr 29, 2022
The bit you’ve keyed in on in the logs is a red herring. We need a repro and/or a full server log.
flupke commentedon Apr 29, 2022
This happens to me constantly too, here is a log demonstrating the issue:
tsserver-autoimport-failure-before-restart.log
OperationsCachto trigger an auto-import and it failsjscheel commentedon Apr 29, 2022
Andrew Branch (@andrewbranch) is Luper Rouch (@flupke)'s log enough to go off of, or do you need more from me?
andrewbranch commentedon May 2, 2022
This isn’t a TSServer log; it’s VS Code’s client log from communicating with TS Server. It doesn’t contain any useful info on its own. See https://github.com/microsoft/TypeScript/wiki/Getting-logs-from-TS-Server-in-VS-Code for instructions on how to collect a log. Jared A. Scheel (@jscheel) no log will ever be as good as a full repro.
flupke commentedon May 3, 2022
Here are TSServer logs of an auto import failure:
fail-autoimport.zip
(look for
getTypedLayerDe\bnear the end)And the same auto completion after a restart:
success-autoimport.zip
andrewbranch commentedon May 3, 2022
There’s no error in the logs, so unfortunately it doesn’t give me anything to go on. This isn’t going to be actionable without either (a) a way I can reproduce the issue on my own machine, or (b) hopping on a call and LiveShare debugging a repro on your machine.
jscheel commentedon May 4, 2022
I'm not sure I can put together a reproducible case, since I don't have a clear pattern and inside a very large project. I can provide a bit more info: it just happened when I had two files open in vscode. Intellisense brought up the appropriate import on one file, which I then inserted and saved. Then I switch to the other open file, and it couldn't find anything. The import was relative to both files' locations, with the same depth of directory traversal. I'm definitely down for a liveshare, if that would help. It happens enough that we should be able to trigger it.
andrewbranch commentedon May 4, 2022
And to clarify, once it can’t find the auto-import, you restarted TS Server without changing anything else and then it appeared? There are lots of reasons why an auto-import might not show up, but if you can fix it just by restarting the server it’s definitely a bug.
flupke commentedon May 4, 2022
It seems to often happen to me after switching to a new file too. I'm also working on a fairly large project and I did not notice a clear pattern yet.
andrewbranch commentedon May 4, 2022
Roughly how long is a long time?
Was the imported file part of a different project in a project references setup?
By "new file" do you mean a file you just created or an existing file you just opened?
flupke commentedon May 4, 2022
Yep, just restarting the server and triggering the exact same completion at the same spot is enough to fix the issue.
jscheel commentedon May 4, 2022
Yep, just restarted ts server and boom, it popped up
andrewbranch commentedon May 4, 2022
Next time that happens, instead of restarting the server, can you try going to a different file in the same tsconfig.json project (this won’t work if you go to a file in another composite project), trigger completions there (in a way that gets auto-imports, i.e. not a property access), and then go back to the original file and try again?
13 remaining items
andrewbranch commentedon May 5, 2022
Jared A. Scheel (@jscheel) if my hypothesis and fix at #48979 is correct, you’ll see a response that looks something like
{"seq":0,"type":"response","command":"completionInfo","request_seq":290,"success":true,"performanceData":{"updateGraphDurationMs":48.1666110008955},"body":{"canceled":true}}in your TS Server log shortly before things go off the rails.jscheel commentedon May 5, 2022
Andrew Branch (@andrewbranch) I don't see it right now, because I had my logging paired down, but I seem to recall seeing that the other day.
andrewbranch commentedon May 5, 2022
I’m 100% sure that cancellation here can corrupt the cache and that it happened in Luper Rouch (@flupke)’s failure log, so the case is all but closed.
andrewbranch commentedon May 5, 2022
In ~11 hours you’ll be able to try typescript@4.7.0-dev.20220506 and I expect that should do better. Let me know if not. Thanks for answering a million questions!
jscheel commentedon May 5, 2022
Andrew Branch (@andrewbranch) awesome, super excited to try it out! Thank you so much for sticking with Luper Rouch (@flupke) and I, even when we couldn't provide the best debugging details.
flupke commentedon May 9, 2022
Andrew Branch (@andrewbranch) I didn't use the feature much today, but it's been working flawlessly with typescript@4.7.0-dev.20220506 so far! 👏 🎉
jscheel commentedon Oct 11, 2022
cilvet commentedon Dec 19, 2023
Hi! I've been having trouble with autocomplete lately and I've stumbled upon this thread, which is the only one that pops up when looking for "AutoImportProviderProject: attempted to add more than" besides the code itself xD
The thing is, I was having trouble with autocomplete in a new project with lots of dependencies, and I tried going into the code and changing the hardcoded maxDependencies from 10 to 100, which solved the problem at the cost of extremely poor performance and constant process kills (which is to be expected).
I checked a different project in which autocomplete works well, and I see that it's loading 6 dependencies. I don't quite understand what might be happening here, I expect the ts server to work under any amount of dependencies.
I feel like there is something here I'm not understanding correclty