question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Language server doesn't like a particular line of code

See original GitHub issue

Your environment

  • vscode-ruby version: 0.28.0
  • Ruby version: 2.7.2
  • Ruby version manager (if any): asdf
  • VS Code version: 1.52.1
  • Operating System: macOS 11.1
  • Using language server? (eg useLanguageServer is true in your configuration?) yes

Expected behavior

  • Letting me view my Terminal while I work

Actual behavior

  • The actual extension functionality seems to work fine, but after I view a certain file, every time I click anywhere in Ruby file, my Terminal is switched to Output, which is incredibly disruptive (is there a way to switch that off perhaps?). Under Output, I see something like the following, which, according to my Google searches, is just generic extension errors:
Initializing Ruby language server...
TypeError: Cannot read property 'apply' of undefined
    at t.<computed> (/Users/anamba/.vscode/extensions/rebornix.ruby-0.28.0/dist/server/index.js:16:235186)
    at <anonymous>:wasm-function[20]:0x908
    at <anonymous>:wasm-function[19]:0x4a8
    at <anonymous>:wasm-function[80]:0x15c68
    at <anonymous>:wasm-function[129]:0x25fcc
    at ts_parser_parse_wasm (<anonymous>:wasm-function[248]:0x2d59c)
    at he.parse (/Users/anamba/.vscode/extensions/rebornix.ruby-0.28.0/dist/server/index.js:16:261383)
    at Object.createTree (/Users/anamba/.vscode/extensions/rebornix.ruby-0.28.0/dist/server/index.js:16:176062)
    at e.project (/Users/anamba/.vscode/extensions/rebornix.ruby-0.28.0/dist/server/index.js:16:176538)
    at e._next (/Users/anamba/.vscode/extensions/rebornix.ruby-0.28.0/dist/server/index.js:16:117207)
[Error - 11:11:12 AM] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 11:11:12 AM] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 11:11:15 AM] Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Cannot read property 'rootNode' of undefined
  Code: -32603

I ultimately narrowed it down to these two lines (part of a merge method):

    photos.each { |obj| target.photos << obj }
    notes.each { |obj| target.notes << obj }

If I reload the window, all is well until I switch to that particular tab again, and then after that, any time I click anywhere in any ruby file, I get more errors under Output.

Rewriting those lines to this helped:

    photos.each { |obj| obj.update(entity: target) }
    notes.each { |obj| obj.update(entity: target) }

🤷‍♂️

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:23

github_iconTop GitHub Comments

7reactions
qortexcommented, Jan 7, 2021

I also get a lot of errors like that since the last update. Pasting some of them here if it helps in the debugging:

[Error - 09:37:57] Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Cannot read property 'rootNode' of undefined
  Code: -32603 
[Error - 09:37:58] Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Cannot read property 'rootNode' of undefined
  Code: -32603 
[Error - 09:37:58] Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Cannot read property 'rootNode' of undefined
  Code: -32603 
[Error - 09:37:59] Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Cannot read property 'rootNode' of undefined
  Code: -32603 
[Error - 09:38:00] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:00] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:38:04] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:04] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:38:04] Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Cannot read property 'rootNode' of undefined
  Code: -32603 
[Error - 09:38:07] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:07] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:38:13] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:13] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:38:17] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:17] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:38:18] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:18] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:38:18] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:18] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:38:19] Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Cannot read property 'rootNode' of undefined
  Code: -32603 
[Error - 09:38:26] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:26] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:38:26] Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Cannot read property 'rootNode' of undefined
  Code: -32603 
[Error - 09:38:41] Request textDocument/documentHighlight failed.
  Message: Request textDocument/documentHighlight failed with message: Cannot read property 'rootNode' of undefined
  Code: -32603 
[Error - 09:38:43] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:43] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
[Error - 09:38:43] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:50:20] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read property 'documentSymbols' of undefined
  Code: -32603 
[Error - 09:50:20] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read property 'foldingRanges' of undefined
  Code: -32603 
3reactions
wingrunr21commented, Jan 9, 2021

Great! Have a great weekend!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Server Extension Guide - Visual Studio Code
Learn how to create Language Servers to provide rich language features in Visual Studio Code.
Read more >
Troubleshooting - haskell-language-server - Read the Docs
The server crashes on certain files. A code action doesn't work the way it's supposed to. Unclear examples: Hover documentation looks wrong (the...
Read more >
#Backend, David Driscoll, If I can make a Language Server, so ...
Do you regularly have to use a language like php or python? What if I told you there were language servers for those...
Read more >
Why LSP? - matklad
LSP (language server protocol) is fairly popular today. ... If you want to support a particular language in a particular editor, ...
Read more >
textDocument/hover doesn't work until file is opened in ...
I tried to create a language client that communicates with an external language server ... That doesn't seem like a typical IDE workflow....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found