Solargraph: Latest solargraph can not load when using `parser` gem

Created on 30 Apr 2020  ยท  6Comments  ยท  Source: castwide/solargraph

Since updating solargraph it no longer runs, I get the error: uninitialized constant Solargraph::Parser::VERSION (NameError)

I have narrowed it down to only breaking when the parser gem is installed in the current project (either directly in the Gemfile or as a dependency of something else in the gemfile)

Most helpful comment

Fixed for real in 0.39.6.

All 6 comments

I can't reproduce this with a scratch project with parser in the Gemfile.

What versions of Ruby, solargraph, and parser are you using? Are you starting the language server with bundle?

I am using Ruby 2.6.3, latest solargraph, and latest parser.

I think the issue may be that the projects are run using Docker. The gem folders are in the project directory. Because the gems are in a local directory, and the project uses docker, the system does not have access to those gems, so I do not run things like solargraph with bundle (so the system can use it and run it inside vim).

I have created a basic repo that can be used to reproduce the issue: https://github.com/kthibodeaux/solargraph_bug_demo

The readme has steps to get the error, and steps that show when solargraph is downgraded that it works.

โฏ solargraph typecheck app/helpers/application_helper.rb
/home/kthibodeaux/dev/test_app/bundle/gems/bundler-2.1.4/lib/bundler/version.rb:4: warning: already initialized constant Bundler::VERSION
/home/kthibodeaux/.gem/ruby/2.6.3/gems/bundler-2.1.4/lib/bundler/version.rb:4: warning: previous definition of VERSION was here
Traceback (most recent call last):
        20: from /home/kthibodeaux/.gem/ruby/2.6.3/bin/solargraph:23:in `<main>'
        19: from /home/kthibodeaux/.gem/ruby/2.6.3/bin/solargraph:23:in `load'
        18: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/bin/solargraph:5:in `<top (required)>'
        17: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
        16: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
        15: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
        14: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
        13: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/shell.rb:138:in `typecheck'
        12: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/api_map.rb:172:in `load'
        11: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/api_map.rb:172:in `new'
        10: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/workspace.rb:29:in `initialize'
         9: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/workspace.rb:165:in `generate_require_paths'
         8: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/workspace.rb:165:in `each'
         7: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/workspace.rb:170:in `block in generate_require_paths'
         6: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/workspace.rb:170:in `chdir'
         5: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/workspace.rb:173:in `block (2 levels) in generate_require_paths'
         4: from /home/kthibodeaux/.gem/ruby/2.6.3/gems/solargraph-0.39.4/lib/solargraph/workspace.rb:173:in `eval'
         3: from /home/kthibodeaux/dev/test_app/bundle/ruby/2.6.0/gems/parser-2.7.1.2/parser.gemspec:6:in `block (2 levels) in generate_require_paths'
         2: from /home/kthibodeaux/dev/test_app/bundle/ruby/2.6.0/gems/parser-2.7.1.2/parser.gemspec:6:in `new'
         1: from /home/kthibodeaux/.rubies/ruby-2.6.3/lib/ruby/2.6.0/rubygems/specification.rb:2067:in `initialize'
/home/kthibodeaux/dev/test_app/bundle/ruby/2.6.0/gems/parser-2.7.1.2/parser.gemspec:8:in `block (3 levels) in generate_require_paths': uninitialized constant Solargraph::Parser::VERSION (NameError)
Did you mean?  Solargraph::VERSION

Probably, it's related.
In versions >= 0.39.0 when I start LSP from Emacs I get an error:
image

Then LSP hangs with
image

This should be fixed in 0.39.5.

Sorry, turns out there's still a problem with this one, but I'll have it fixed in the next patch release.

Fixed for real in 0.39.6.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tylerlu94 picture tylerlu94  ยท  5Comments

Sam-Killgallon picture Sam-Killgallon  ยท  5Comments

art-solopov picture art-solopov  ยท  3Comments

dgutov picture dgutov  ยท  5Comments

dansdantas picture dansdantas  ยท  5Comments