castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
425 stars 23 forks source link

undefined method `each_char' for #<Solargraph::ComplexType #122

Closed freemanoid closed 5 years ago

freemanoid commented 5 years ago
Solargraph Environment Info
System
Platform: x86_64-darwin18
Shell: /bin/zsh
Ruby Version: 2.4.4
Solargraph
Solargraph Version: 0.32.5
Core Documentation Version: 2.2.2
Core Cache Directory: /Users/freemanoid/.solargraph/cache
Parser Target Version: 24
Using Bundler: false
Project
Config: {"completion"=>true, "hover"=>true, "symbols"=>true, "definitions"=>true, "rename"=>true, "references"=>true, "autoformat"=>false, "diagnostics"=>false, "formatting"=>false, "folding"=>true, "logLevel"=>"warn", "enablePages"=>true, "viewsPath"=>"/Users/freemanoid/.vscode/extensions/castwide.solargraph-0.19.6/views", "transport"=>"socket", "externalServer"=>{"host"=>"localhost", "port"=>7658}, "commandPath"=>"/Users/freemanoid/.rvm/gems/ruby-2.4.4/bin/solargraph", "useBundler"=>false, "bundlerPath"=>"bundle", "checkGemVersion"=>true}

I'm keep getting

undefined method `each_char' for Solargraph::ComplexType

For different requests. E.g.

Request completionItem/resolve failed.
Request textDocument/documentSymbol failed.
Request textDocument/hover failed.

Full error example:

[Error - 10:50:52 AM] Request textDocument/documentSymbol failed.
  Message: [NoMethodError] undefined method `each_char' for #<Solargraph::ComplexType:0x00007fb828fa2520>
Did you mean?  each_cons
  Code: -32603 

Error from dev tools:

[Extension Host] [WARN] Error processing request: [NoMethodError] undefined method `each_char' for #<Solargraph::ComplexType:0x00007fb80ce26c08>
Did you mean?  each_cons

workbench.main.js:238 [Extension Host] [WARN] ["/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/complex_type.rb:33:in `method_missing'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/complex_type.rb:74:in `block in parse'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/complex_type.rb:68:in `each'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/complex_type.rb:68:in `parse'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/complex_type.rb:138:in `try_parse'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/pin/base_variable.rb:67:in `generate_complex_type'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/pin/base_variable.rb:31:in `return_complex_type'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/pin/base_variable.rb:58:in `try_merge!'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/source_map.rb:106:in `block in try_merge!'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/source_map.rb:105:in `each_index'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/source_map.rb:105:in `try_merge!'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/api_map.rb:78:in `block in catalog'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/api_map.rb:68:in `each'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/api_map.rb:68:in `catalog'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/library.rb:347:in `block in catalog'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/library.rb:344:in `synchronize'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/library.rb:344:in `catalog'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/library.rb:263:in `checkout'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/library.rb:176:in `definitions_at'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/host.rb:476:in `definitions_at'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/message/text_document/definition.rb:8:in `process'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/host.rb:94:in `receive'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/transport/adapter.rb:36:in `process'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/transport/adapter.rb:14:in `block in opening'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/transport/data_reader.rb:53:in `parse_message_from_buffer'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/transport/data_reader.rb:31:in `block in receive'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/transport/data_reader.rb:26:in `each_char'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/transport/data_reader.rb:26:in `receive'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/solargraph-0.32.5/lib/solargraph/language_server/transport/adapter.rb:25:in `receiving'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/backport-1.1.1/lib/backport/client.rb:63:in `tick'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/backport-1.1.1/lib/backport/server/tcpip.rb:76:in `update'", "/Users/freemanoid/.rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/observer.rb:197:in `block in notify_observers'", "/Users/freemanoid/.rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/observer.rb:196:in `each'", "/Users/freemanoid/.rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/observer.rb:196:in `notify_observers'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/backport-1.1.1/lib/backport/client.rb:121:in `read_input'", "/Users/freemanoid/.rvm/gems/ruby-2.4.4/gems/backport-1.1.1/lib/backport/client.rb:102:in `block in run_input_thread'"]
castwide commented 5 years ago

I'm unable to reproduce this error at the moment, but I suspect it's already fixed in the upcoming gem version 0.33.0 (currently in the castwide/solargraph repo's closure branch). Based on the stack trace, I think it's an issue with how literal values (explicit strings, numbers, arrays, or hashes) get assigned to variable types. The new process eliminates a redundant step where this error likely occurred.

If you can provide a reproducible example, I can try to confirm. If not, we can see if it still happens after 0.33.0.

freemanoid commented 5 years ago

I'm unable to reproduce this error at the moment, but I suspect it's already fixed in the upcoming gem version 0.33.0 (currently in the castwide/solargraph repo's closure branch). Based on the stack trace, I think it's an issue with how literal values (explicit strings, numbers, arrays, or hashes) get assigned to variable types. The new process eliminates a redundant step where this error likely occurred.

If you can provide a reproducible example, I can try to confirm. If not, we can see if it still happens after 0.33.0.

Thank you! I've just checked out 0.33.0 and it works. Looking forward to use released version instead of the one from branch 😃