Language server doesn't like a particular line of code
See original GitHub issueYour 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:
- Created 3 years ago
- Reactions:16
- Comments:23
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I also get a lot of errors like that since the last update. Pasting some of them here if it helps in the debugging:
Great! Have a great weekend!