lsp-format
URL: https://github.com/lukas-reineke/lsp-format.nvim/
Maintainers: Austin Horstman
A wrapper around Neovims native LSP formatting.
Configuring a Language
lsp-format uses a table defining which lsp servers to use for each language.
- excludeis a table of LSP servers that should not format the buffer.- Alternatively, you can also just not call on_attachfor the clients you don't want to use for formatting.
 
- Alternatively, you can also just not call 
- orderis a table that determines the order formatting is requested from the LSP server.
- syncturns on synchronous formatting. The editor will block until the formatting is done.
- forcewill write the format result to the buffer, even if the buffer changed after the format request started.
plugins.lsp-format.enable
Whether to enable lsp-format.
Type: boolean
Default:
false
Example:
true
Declared by:
plugins.lsp-format.package
The lsp-format package to use.
Type: package
Default:
pkgs.vimPlugins.lsp-format-nvim
Declared by:
plugins.lsp-format.autoLoad
Whether to automatically load lsp-format when neovim starts.
Type: boolean
Default:
false when lazy-loading is enabled.
Example:
false
Declared by:
plugins.lsp-format.lspServersToEnable
Choose the LSP servers for which lsp-format should be enabled.
Possible values:
- “all” (default): Enable formatting for all language servers
- “none”: Do not enable formatting on any language server.
You might choose this if for some reason you want to manually call
require("lsp-format").on_attach(client).
- list of LS names: Manually choose the servers by name
Type: one of “none”, “all” or list of string
Default:
"all"
Example:
[
  "efm"
  "gopls"
]
Declared by:
plugins.lsp-format.settings
Options provided to the require('lsp-format').setup function.
Type: lua value
Default:
{ }
Example:
{
  go = {
    exclude = [
      "gopls"
    ];
    force = true;
    order = [
      "gopls"
      "efm"
    ];
    sync = true;
  };
  typescript = {
    tab_width = {
      __raw = ''
        function()
          return vim.opt.shiftwidth:get()
        end'';
    };
  };
  yaml = {
    tab_width = 2;
  };
}
Declared by: