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

TypeScript Server Error - Cannot auto import get code fixes #31975

Closed
donovanhiland opened this issue Jun 18, 2019 · 5 comments
Closed

TypeScript Server Error - Cannot auto import get code fixes #31975

donovanhiland opened this issue Jun 18, 2019 · 5 comments
Assignees
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@donovanhiland
Copy link

  • VSCode Version: 1.36.0-insider
  • OS Version: macOS Mojave 10.14.4
  • Typescript version: tested on 3.5.1, 3.5.2, 3.6.0-dev.20190618

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:

  1. Open vscode
  2. Try to auto import something via the methods described above

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.

@mjbvz mjbvz transferred this issue from microsoft/vscode Jun 18, 2019
@microsoft microsoft deleted a comment from vscodebot bot Jun 18, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Jun 18, 2019

Can you share your project or some example code that demonstrates this issue?

@mjbvz mjbvz removed their assignment Jun 18, 2019
@donovanhiland
Copy link
Author

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.

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Jun 26, 2019
@donovanhiland
Copy link
Author

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.

@lstkz
Copy link

lstkz commented Sep 1, 2019

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:

  • write some code
  • create a new file (react component)
  • auto-import is broken
  • restart TS server from the command menu

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.

@donovanhiland
Copy link
Author

donovanhiland commented Oct 23, 2019

Closing as issue was solved per #31975 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

4 participants