puppetlabs / puppet-editor-services

Puppet Language Server for editors
Apache License 2.0
45 stars 21 forks source link

message in vim : An error occured while starting the Language Server #267

Closed Dan33l closed 4 years ago

Dan33l commented 4 years ago

Describe the Bug

I am able to start manually the language server with bundle exec ruby ./puppet-languageserver --debug=stdout

But in vim, when i am editing a manifest i am getting the following message in the status bar An error occured while starting the Language Server

Expected Behavior

Working with vim + coc and without error message.

Steps to Reproduce

Steps to reproduce the behavior:

  1. git clone https://github.com/lingua-pupuli/puppet-editor-services.git
  2. cd puppet-editor-services
  3. git fetch --all --tag
  4. git checkout tags/0.26.1
  5. bundle install --path vendor
  6. bundle exec rake gem_revendor
  7. vim +CocConfig to configure Coc with bellow settings.
  8. vim /opt/dockerspace/build/puppet-apache/manifest/init.pp <-- here getting the error message

Environment

Additional Context

Dan33l commented 4 years ago

The details about debug message was :

$> ruby ./puppet-languageserver --stdio --puppet-settings=--moduledir,/opt/dockerspace/build/ --debug=stdout
I, [2020-07-10T10:52:59.646178 #40137]  INFO -- : Language Server is v0.26.1
D, [2020-07-10T10:52:59.646222 #40137] DEBUG -- : Loading gems...
E, [2020-07-10T10:52:59.673781 #40137] ERROR -- : Error while loading a critical gem: cannot load such file -- puppet ["/home/fcombernous/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'", "/home/fcombernous/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'", "/home/fcombernous/Documents/puppet-editor-services/lib/puppet_languageserver.rb:75:in `require_gems'", "/home/fcombernous/Documents/puppet-editor-services/lib/puppet_languageserver.rb:216:in `init_puppet'", "./puppet-languageserver:13:in `<main>'"]
I, [2020-07-10T10:52:59.674873 #40137]  INFO -- : Starting RPC Server...
I, [2020-07-10T10:52:59.675018 #40137]  INFO -- : Configured the Language Server to use the Disabled Message Router
D, [2020-07-10T10:52:59.675037 #40137] DEBUG -- : Using STDIO Server
D, [2020-07-10T10:52:59.676712 #40137] DEBUG -- : STDIOSRV: Starting STDIO server...

That we have to understand as ERROR -- : Error while loading a critical gem: cannot load such file -- puppet. It is missing puppet gem.

So the puppet gem have to be installed out of bundle process. And gem install puppet permitted to start the language server in vim. Thank you @glennsarti for this debugging session.