jupyterlab-lsp icon indicating copy to clipboard operation
jupyterlab-lsp copied to clipboard

Allo to pass Initialization Options

Open henryju opened this issue 2 years ago • 2 comments

Our language server is expecting some initialization options in the InitializeParams. Looking at the code, it seems it is not possible: https://github.com/jupyter-lsp/jupyterlab-lsp/blob/84121b44323172b16ab25c1bcd98d41ec1ee8513/packages/jupyterlab-lsp/src/connection.ts#L410

Would be great to have a way to pass them in the jupyter_server_config.json:

{
    "LanguageServerManager": {
      "language_servers": {
        "sonarlint": {
          "version": 2,
          "argv": ["C:\\Prog\\Projects\\sonarlint\\sonarlint-language-server\\sonarlint-ls.bat"],
          "languages": ["python"],
          "mime_types": ["text/python", "text/x-ipython"],
          "display_name": "SonarLint LS",
          "initializationOptions": {
            // my LS initializationOptions
          }
        }
      }
    }
  }

henryju avatar May 13 '22 12:05 henryju

Could you please provide an example of initialisation options? Would you expect user to be able to modify the initializationOptions in the settings? I presume that they differ from configuration / settings, right?

krassowski avatar Jun 24 '22 11:06 krassowski

My understanding is that initialization options are not intended to be user-controlled, but more a way to customize the behavior of a language server depending on the client using it. The same could be achieved using command line arguments, but I guess it can quickly become a problem if there are too many params or if trying to pass structured data.

For SonarLint LS, here are the initialization params we have today: https://github.com/SonarSource/sonarlint-vscode/blob/3ca327c4034f32ed452fb7a2ecff6e1aaa85ab0c/src/extension.ts#L209

henryju avatar Jun 24 '22 11:06 henryju