Skip to content

Understanding setup {}

Michael Lingelbach edited this page Aug 24, 2021 · 11 revisions

The principal way of enabling a language server with lspconfig is the setup {} call. The main keys users will typically pass into setup are settings on_init, and on_attach.

settings

The settings table is sent to the language server via a workspace/didChangeConfigurationnotification from the client. lspconfig sends this notification for you automatically during initialization of the language server using the cached settings table you pass to setup{}.

In most cases, the default settings are correct. If you would like to override the settings you can see available options in CONFIG.md, these are auto-generated from the package.json used by the vscode plugin leveraging the language server, if available. For pyright as an example, the pyright.disableLanguageServices option listed in the drop down settings menu in CONFIG.md can be sent as follows:

require('lspconfig').pyright.setup {
  settings = {
    pyright = {
      disableLanguageServices = true,
    },
  },
}