puppetlabs / puppet-editor-services

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

Support puppet configuration through `initializationOptions` #354

Open mehalter opened 8 months ago

mehalter commented 8 months ago

Use Case

The VS Code puppet extension is nice because it allows the use of the LSP settings table to configure the parameters used when starting the language server. This doesn't actually follow the official LSP specification and leaves other language server clients in other editors unable to utilize these options.

This also tightly couples the language server and the VS Code extension where default client settings are set in the language server:

https://github.com/puppetlabs/puppet-editor-services/blob/d68eab43bb61f88e6c309610670a87826848658b/spec/languageserver/editor_client.rb#L30-L35

but these are features/options purely implemented in the VS Code extension. If there are changes to the VS Code extension, then it could force changes back to the language server for no real reason.

Describe the Solution You Would Like

Utilize the initializationOptions field in the InitializeParams part of the LSP spec (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize)

This will allow full configuration of the initialization of the language server without having to rely on building up argument lists. Adopting the official approach by the LSP specification would add many improvements: