erlang-ls / erlang_ls

The Erlang Language Server
https://erlang-ls.github.io/
Apache License 2.0
625 stars 136 forks source link

LSP Configuration Schema #1293

Open illotum opened 2 years ago

illotum commented 2 years ago

Is your feature request related to a problem? Please describe. Some editors use JSON schema to generate configuration menus or hints for the language server configuration over the wire. Known to me are VSCode and NeoVim via nvim-lsp-installer.

Describe the solution you'd like Ship JSON schema describing all server config options for programmatic consumption.

Describe alternatives you've considered A document, or even part of README, can list all options as alternative or in addition to the schema.

Additional context It is quite difficult to discern options that are available for any given server, ErlangLS included.

robertoaloi commented 2 years ago

Hi @illotum , that is not a bad idea. We have a partial configuration here, but it would be good to extend it to be comprehensive. We may want to either generate an erlang_ls.config file from that or to amend the Erlang LS CLI to accept individual config options at startup. FYI @TheGeorge @alanz @michalmuskala

illotum commented 2 years ago

We may want to either generate an erlang_ls.config file

My bad! I should've clarified, the schema is meant for the client config. Here's a snippet from nvim docs:

- {settings} `table <string, string|table|bool>`  

  The `settings` table is sent in `on_init` via a
  `workspace/didChangeConfiguration` notification from the Nvim client to
  the language server. These settings allow a user to change optional runtime
  settings of the language server. 

  As an example, to set the following settings found in the pyright
  documentation:

  `pyright.disableLanguageServices`: `boolean`
  `pyright.disableOrganizeImports`: `boolean`

  Nested keys need to be translated into a nested table and passed to
  the settings field in `setup {}` as follows:
>
  require('lspconfig').pyright.setup{
    settings = {
      pyright = {
          disableLanguageServices = true,
          disableOrganizeImports  = true,
        }
    }
  }
<

Most of the known to me language servers use it as the preferred configuration input, not files. Here's example from my setup of gopls:

            settings = {
                hoverKind = "SynopsisDocumentation",
                usePlaceholders = true,
                gofumpt = true,
                analyses = {
                    nilness = true,
                    fieldalignment = true,
                    unusedparams = true,
                    unusedwrite = true,
                },
                staticcheck = true,
            },
robertoaloi commented 2 years ago

Ah, I see now. No, this is not currently in place.