TypeScript: Auto-import consistently failing after a few minutes (happening in vscode, nightly ts)
Bug Report
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.
🙂 Expected behavior
Auto import works consistently.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 34 (15 by maintainers)
@andrewbranch I didn’t use the feature much today, but it’s been working flawlessly with typescript@4.7.0-dev.20220506 so far! 👏 🎉
Also when it happens, check the Output panel of the Extension Host in VS Code and make sure you don’t see any errors—I didn’t see any in @flupke’s logs but it’s possible the two of you are experiencing different root causes. If there’s an error stack it will obviously narrow down where to look a lot.