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

TSServer completions request: Cannot read property 'forEach' of undefined #16610

Closed
mattbierner opened this issue Jun 19, 2017 · 8 comments
Closed
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mattbierner
Copy link

TypeScript Version: 2.4.1-insiders20170615

While working in a TS file with VS code, I see this error from the TSServer:

[Trace  - 12:37:05 PM] Response received: completions (4494). Request took 20 ms. Success: false . Message: Error processing request. Cannot read property 'forEach' of undefined
TypeError: Cannot read property 'forEach' of undefined
    at symbolsToArray (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:27957:20)
    at Object.getExportsOfModuleAsArray [as getExportsOfModule] (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:24310:20)
    at symbolCanbeReferencedAtTypeLocation (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62880:55)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62844:36
    at Object.filter (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:1439:25)
    at filterGlobalCompletion (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62830:27)
    at tryGetGlobalSymbols (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62826:27)
    at getCompletionData (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62718:22)
    at Object.getCompletionsAtPosition (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62338:34)
    at Object.getCompletionsAtPosition (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:74358:35)

Not sure how to reliable reproduce it yet

@DanielRosenwasser
Copy link
Member

Duplicate of #16610.

@DanielRosenwasser DanielRosenwasser added the Duplicate An existing issue was already created label Jun 19, 2017
@mjbvz
Copy link
Contributor

mjbvz commented Jun 28, 2017

@DanielRosenwasser That's this bug. Reopening as a still see this in @next

@roblourens
Copy link
Member

I repro this with 2.4.1 in VS Code when I open a file which contains only:

let x: 

And trigger completions at the end of the line.

TS server log:
tsserver.txt

Snippet:

Info 41   request: {"seq":10,"type":"request","command":"completions","arguments":{"file":"/Users/roblou/tmp/tsc/foo.ts","line":1,"offset":8}}
Err 42    Exception on executing command {"seq":10,"type":"request","command":"completions","arguments":{"file":"/Users/roblou/tmp/tsc/foo.ts","line":1,"offset":8}}:
Cannot read property 'forEach' of undefined
TypeError: Cannot read property 'forEach' of undefined
    at symbolsToArray (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:27963:20)
    at Object.getExportsOfModuleAsArray [as getExportsOfModule] (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:24316:20)
    at symbolCanbeReferencedAtTypeLocation (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62889:55)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62853:36
    at Object.filter (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:1439:25)
    at filterGlobalCompletion (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62839:27)
    at tryGetGlobalSymbols (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62835:27)
    at getCompletionData (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62727:22)
    at Object.getCompletionsAtPosition (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:62347:34)
    at Object.getCompletionsAtPosition (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:74367:35)

@roblourens
Copy link
Member

Probably duplicate of #16537, maybe that's what you meant

@mjbvz mjbvz removed the Duplicate An existing issue was already created label Jul 3, 2017
@mjbvz
Copy link
Contributor

mjbvz commented Jul 3, 2017

@rbuckton Can we get this bug fixed for TS 2.4.2? I've seen it hit it in a number of cases and it now that @roblourens has provided a more reliable repo, we should be able to track down what is going wrong

@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Jul 3, 2017
@rbuckton rbuckton assigned ghost Jul 6, 2017
@rbuckton
Copy link
Member

rbuckton commented Jul 6, 2017

@andy-ms Can you take a look at this? It may be related to your comment on #16537

@ghost
Copy link

ghost commented Jul 7, 2017

Fixed by #17013

@ghost ghost closed this as completed Jul 7, 2017
@ghost ghost added Fixed A PR has been merged for this issue Bug A bug in TypeScript labels Jul 7, 2017
@mjbvz
Copy link
Contributor

mjbvz commented Jul 7, 2017

Thanks @andy-ms! Can we take this change into TS 2.4.2 as well?

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

5 participants