erlang_ls icon indicating copy to clipboard operation
erlang_ls copied to clipboard

LSP Configuration Schema

Open illotum opened this issue 2 years ago • 3 comments

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.

illotum avatar May 10 '22 21:05 illotum

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

robertoaloi avatar May 11 '22 07:05 robertoaloi

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,
            },

illotum avatar May 11 '22 16:05 illotum

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

robertoaloi avatar May 13 '22 12:05 robertoaloi