Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code - Request textDocument/definition failed

I really like VS Code, which I use primarily for JS and React (jsx). Sometimes when I code, a panel pops up with a message:

[Error - 13:45:45] Request textDocument/definition failed. Message: Request textDocument/definition failed with message: Cannot read property 'charCodeAt' of undefined Code: -32603

How can get rid of this error message or prevent opening a panel when Request textDocument/definition failed?

like image 711
Matt Avatar asked Apr 10 '18 12:04

Matt


3 Answers

When you see strange errors like your Request textDocument/definition failed in any ecosystem with plugins, the best place to start hunting is in the error logs of that application. Errors like this normally show up when you update the core application, which will shift its own API enough to break contrib code like this.

In terms of VS Code specifically, it requires you turn on logging within the Help -> Toggle Developer Tools menu, which then creates logs you can go scan.

Looks like you found the error pretty easily in the tern.js plugin you were using, but the same general flow for debugging big ecosystems like node.js, React and others follow this same pattern.

like image 162
serraosays Avatar answered Nov 16 '22 22:11

serraosays


Quick google and found a SO link which says this is a know issue and a workaround is to open Visual Studio Code on a folder instead of a file.

https://stackoverflow.com/a/40631794/1249386

GitHub link : https://github.com/Microsoft/vscode/issues/15018 Let me know if this help you or not?

like image 44
Sigar Dave Avatar answered Nov 16 '22 21:11

Sigar Dave


Could that be the vetur Plugin? It seems to have some language issues.

like image 1
jjmerelo Avatar answered Nov 16 '22 23:11

jjmerelo