Skip to content

Conversation

@glennsarti
Copy link
Contributor

Fixes #118

Previously the language server would crash/terminate early if a critical gem
like puppet was unavailable. This can happen when the ruby environment is not
from the Puppet Agent or PDK. This commit changes the behaviour of the
Language Server to still execute but it a completely disable fashion:

  • Detects a failed gem load for critical gems and sets
    PuppetLanguageServer.active? is to false
  • When the Language Server is not active, a different Message Router is used
    which effectively warns the user that the server failed to start and that
    all functions are disabled. The server responds to the client with no
    capabilities and the custom getVersion request, is responded to with
    unknown data

No automated tests were added as this is an edge case. Manual testing was
performed by changing the call require 'puppet' to require 'puppetxxxxx'
which is enough to trigger a failure.

Previously the language server would crash/terminate early if a critical gem
like puppet was unavailable.  This can happen when the ruby environment is not
from the Puppet Agent or PDK.  This commit changes the behaviour of the
Language Server to still execute but it a completely disable fashion:

* Detects a failed gem load for critical gems and sets
  PuppetLanguageServer.active? is to false
* When the Language Server is not active, a different Message Router is used
  which effectively warns the user that the server failed to start and that
  all functions are disabled. The server responds to the client with no
  capabilities and the custom getVersion request, is responded to with
  unknown data

No automated tests were added as this is an edge case.  Manual testing was
performed by changing the call `require 'puppet'` to `require 'puppetxxxxx'`
which is enough to trigger a failure.
@glennsarti glennsarti self-assigned this May 27, 2019
@glennsarti glennsarti added enhancement New feature or request Language Server labels May 27, 2019
@jpogran jpogran added this to the 0.20.0 milestone May 28, 2019
@jpogran jpogran merged commit 8d450ee into puppetlabs:master May 28, 2019
@glennsarti glennsarti modified the milestones: 0.20.0, 0.19.1 May 29, 2019
@glennsarti glennsarti deleted the gh-118-fail-if-no-puppet branch May 30, 2019 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language Server should gracefully fail if Puppet gem cannot be found

2 participants