Auto import does not work. Typescript server errors out when trying to auto import either by intellisense completion, cmd+. or hover and click Quick Fix
tsserver.log error
Err 1197 [14:49:8.716] Exception on executing command {"seq":28,"type":"request","command":"getCodeFixes","arguments":{"file":"/Users/donovanhiland/src/lx/src/shared/components/onboarding/RestoreSessionScreen/RestoreSessionScreen.tsx","startLine":58,"startOffset":12,"endLine":58,"endOffset":24,"errorCodes":[2304]}}:
Debug Failure.
Error: Debug Failure.
at Object.assertDefined (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:2080:24)
at getDefaultExportInfoWorker (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115542:80)
at getDefaultLikeExportInfo (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115523:24)
at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115506:35
at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115650:21
at forEachExternalModule (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115663:21)
at forEachExternalModuleToImportFrom (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115648:13)
at getExportInfos (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115504:13)
at getFixesInfoForNonUMDImport (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115490:57)
at getFixesInfo (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115431:50)
at Object.getCodeActions (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:115193:28)
at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:112841:121
at Object.flatMap (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:573:25)
at Object.getFixes (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:112841:23)
at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:122417:35
at Object.flatMap (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:573:25)
at Object.getCodeFixesAtPosition (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:122415:23)
at IOSession.Session.getCodeFixes (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:131471:64)
at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:130221:61)
at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:131665:88
at IOSession.Session.executeWithRequestId (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:131656:28)
at IOSession.Session.executeCommand (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:131665:33)
at IOSession.Session.onMessage (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:131687:35)
at Interface.<anonymous> (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:132978:27)
at Interface.emit (events.js:182:13)
at Interface._onLine (readline.js:290:10)
at Interface._normalWrite (readline.js:433:12)
at Socket.ondata (readline.js:149:10)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes
I realize this might not be very much information. This does not happen on an extremely simple test project with the same tsconfig. Please let me know what if anything else I can do to provide more information.
Can you share your project or some example code that demonstrates this issue?
Unfortunately I can't share the project. I'm working on creating some example code with the same config but I can't reproduce. I'm wondering if it has something to do with the size of the project? The codebase where this is manifesting is decently big. It also looks like it's related to the allowSyntheticDefaultImports option being set to true. Setting it to false resolves the issue.
If this still doesn't help I can keep trying to reproduce.
Doing a search for getDefaultExportInfoWorker led me to #29227 which turns out to be the issue. We have a file re-exporting a non-existent default export from another file which resulted in the crash.
I have a similar problem, but auto-import is broken after creating a new file.
tsserver.log doesn't have any errors.
My workflow looks like this:
After restarting, auto-import is not broken if I create another file. But only after some time, and always if I create a new file. I must restart the TS server every 20-40 min.
Closing as issue was solved per https://github.com/microsoft/TypeScript/issues/31975#issuecomment-506466520
Most helpful comment
Doing a search for
getDefaultExportInfoWorkerled me to #29227 which turns out to be the issue. We have a file re-exporting a non-existent default export from another file which resulted in the crash.