Solargraph: crash in VSCode with Ruby files

Created on 23 Feb 2019  路  5Comments  路  Source: castwide/solargraph

VSCode Version 1.31.1
Solargraph Version 0.31.3
Ruby Version Version 2.3.7p456
Docker Version 2.0.0.0-mac81 (29211)
Docker-Sync version 0.5.11

[Error - 5:26:37 PM] Request textDocument/hover failed.
  Message: [NoMethodError] undefined method `each_char' for #<Solargraph::ComplexType:0x00007fc1229675e0>
Did you mean?  each
               each_cons
  Code: -32603 

Most helpful comment

Thanks, @tylerlu94. The root cause appears to be related to variable assignments with literal types, e.g., var = [] or @var = 'var'. I'll work on a fix for the next release.

All 5 comments

Is there a backtrace you can copy/paste in the developer console (Help -> Toggle Developer Tools)?

Sorry about that. Here it is

console.ts:134 [Extension Host] [WARN] Error processing request: [NoMethodError] undefined method `each_char' for #<Solargraph::ComplexType:0x00007fa0187ef148>
Did you mean?  each
               each_cons

console.ts:134 [Extension Host] [WARN] ["/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/complex_type.rb:33:in `method_missing'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/complex_type.rb:74:in `block in parse'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/complex_type.rb:68:in `each'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/complex_type.rb:68:in `parse'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/pin/base_variable.rb:67:in `generate_complex_type'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/pin/base_variable.rb:31:in `return_complex_type'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/pin/base_variable.rb:58:in `try_merge!'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/source_map.rb:106:in `block in try_merge!'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/source_map.rb:105:in `each_index'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/source_map.rb:105:in `try_merge!'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/api_map.rb:78:in `block in catalog'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/api_map.rb:68:in `each'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/api_map.rb:68:in `catalog'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/library.rb:345:in `block in catalog'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/library.rb:342:in `synchronize'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/library.rb:342:in `catalog'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/library.rb:261:in `checkout'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/library.rb:174:in `definitions_at'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/host.rb:477:in `definitions_at'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/message/text_document/hover.rb:11:in `process'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/host.rb:94:in `receive'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/transport/adapter.rb:33:in `process'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/transport/adapter.rb:14:in `block in opening'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/transport/data_reader.rb:53:in `parse_message_from_buffer'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/transport/data_reader.rb:31:in `block in receive'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/transport/data_reader.rb:26:in `each_char'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/transport/data_reader.rb:26:in `receive'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/language_server/transport/adapter.rb:25:in `sending'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/client.rb:48:in `sending'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/server/tcpip.rb:25:in `block (2 levels) in tick'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/server/tcpip.rb:19:in `each'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/server/tcpip.rb:19:in `block in tick'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/server/tcpip.rb:18:in `synchronize'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/server/tcpip.rb:18:in `tick'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/machine.rb:56:in `each'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/machine.rb:56:in `tick'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/machine.rb:64:in `run_server_thread'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport/machine.rb:19:in `run'", "/Library/Ruby/Gems/2.3.0/gems/backport-0.3.0/lib/backport.rb:51:in `run'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/lib/solargraph/shell.rb:25:in `socket'", "/Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'", "/Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'", "/Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'", "/Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'", "/Library/Ruby/Gems/2.3.0/gems/solargraph-0.31.2/bin/solargraph:5:in `<top (required)>'", "/usr/local/bin/solargraph:22:in `load'", "/usr/local/bin/solargraph:22:in `<main>'"]

console.ts:134 [Extension Host] rejected promise not handled within 1 second
t.log @ console.ts:134
e.$logExtensionHostMessage @ mainThreadConsole.ts:39
t._doInvokeHandler @ rpcProtocol.ts:390
t._invokeHandler @ rpcProtocol.ts:375
t._receiveRequest @ rpcProtocol.ts:295
t._receiveOneMessage @ rpcProtocol.ts:225
(anonymous) @ rpcProtocol.ts:100
e.fire @ event.ts:567
s @ ipc.net.ts:295
(anonymous) @ ipc.net.ts:302
e.fire @ event.ts:567
a @ ipc.net.ts:103
_socketDataListener @ ipc.net.ts:132
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
(anonymous) @ async.ts:26
e.fire @ event.ts:567
e.cancel @ cancellation.ts:60
e.cancel @ cancellation.ts:110
e.cancel @ async.ts:39
e.cancel @ hoverOperation.ts:201
t.hide @ modesContentHover.ts:308
e._hideWidgets @ hover.ts:204
e._onEditorMouseMove @ hover.ts:187
(anonymous) @ hover.ts:93
e.fire @ event.ts:567
r.onMouseMove @ codeEditorWidget.ts:1450
t.emitMouseMove @ viewOutgoingEvents.ts:80
e.emitMouseMove @ viewController.ts:293
t._onMouseMove @ mouseHandler.ts:190
(anonymous) @ mouseHandler.ts:102
d @ dom.ts:443
(anonymous) @ dom.ts:454
mainThreadExtensionService.ts:46 [[object Object]]Cannot read property 'contents' of null
e.$onExtensionRuntimeError @ mainThreadExtensionService.ts:46
t._doInvokeHandler @ rpcProtocol.ts:390
t._invokeHandler @ rpcProtocol.ts:375
t._receiveRequest @ rpcProtocol.ts:295
t._receiveOneMessage @ rpcProtocol.ts:225
(anonymous) @ rpcProtocol.ts:100
e.fire @ event.ts:567
s @ ipc.net.ts:295
(anonymous) @ ipc.net.ts:302
e.fire @ event.ts:567
a @ ipc.net.ts:103
_socketDataListener @ ipc.net.ts:132
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
(anonymous) @ async.ts:26
e.fire @ event.ts:567
e.cancel @ cancellation.ts:60
e.cancel @ cancellation.ts:110
e.cancel @ async.ts:39
e.cancel @ hoverOperation.ts:201
t.hide @ modesContentHover.ts:308
e._hideWidgets @ hover.ts:204
e._onEditorMouseMove @ hover.ts:187
(anonymous) @ hover.ts:93
e.fire @ event.ts:567
r.onMouseMove @ codeEditorWidget.ts:1450
t.emitMouseMove @ viewOutgoingEvents.ts:80
e.emitMouseMove @ viewController.ts:293
t._onMouseMove @ mouseHandler.ts:190
(anonymous) @ mouseHandler.ts:102
d @ dom.ts:443
(anonymous) @ dom.ts:454
mainThreadExtensionService.ts:47 TypeError: Cannot read property 'contents' of null
    at middleware.provideHover.promise.then (/Users/tylerlu/.vscode/extensions/castwide.solargraph-0.19.3/out/src/language-client.js:33)
e.$onExtensionRuntimeError @ mainThreadExtensionService.ts:47
t._doInvokeHandler @ rpcProtocol.ts:390
t._invokeHandler @ rpcProtocol.ts:375
t._receiveRequest @ rpcProtocol.ts:295
t._receiveOneMessage @ rpcProtocol.ts:225
(anonymous) @ rpcProtocol.ts:100
e.fire @ event.ts:567
s @ ipc.net.ts:295
(anonymous) @ ipc.net.ts:302
e.fire @ event.ts:567
a @ ipc.net.ts:103
_socketDataListener @ ipc.net.ts:132
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
(anonymous) @ async.ts:26
e.fire @ event.ts:567
e.cancel @ cancellation.ts:60
e.cancel @ cancellation.ts:110
e.cancel @ async.ts:39
e.cancel @ hoverOperation.ts:201
t.hide @ modesContentHover.ts:308
e._hideWidgets @ hover.ts:204
e._onEditorMouseMove @ hover.ts:187
(anonymous) @ hover.ts:93
e.fire @ event.ts:567
r.onMouseMove @ codeEditorWidget.ts:1450
t.emitMouseMove @ viewOutgoingEvents.ts:80
e.emitMouseMove @ viewController.ts:293
t._onMouseMove @ mouseHandler.ts:190
(anonymous) @ mouseHandler.ts:102
d @ dom.ts:443
(anonymous) @ dom.ts:454

Also the issues seem to get resolved after restarting the extension

Thanks, @tylerlu94. The root cause appears to be related to variable assignments with literal types, e.g., var = [] or @var = 'var'. I'll work on a fix for the next release.

@tylerlu94 Are you still experiencing this problem? I'm no longer able to reproduce it using gem v0.32.0.

Haven't run into this issue since the update. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wh1le picture wh1le  路  5Comments

cuongn265 picture cuongn265  路  3Comments

patilarpith picture patilarpith  路  5Comments

megalithic picture megalithic  路  3Comments

castwide picture castwide  路  4Comments