nvim_runtime_lua

vim.lsp.buf.format.Opts

@inlinedoc

Fields8

Opts.formatting_options : lsp.FormattingOptions | nil

Can be used to specify FormattingOptions. Some unspecified options will be automatically derived from the current Nvim options. See https://microsoft.github.io/language-server-protocol/specification/#formattingOptions

Opts.timeout_ms : nil | integer

Time in milliseconds to block for formatting requests. No effect if async=true. (default: 1000)

Opts.bufnr : nil | integer

Restrict formatting to the clients attached to the given buffer. (default: current buffer)

Opts.filter : fun(client: vim.lsp.Client) -> nil | boolean | nil
Opts.async : nil | boolean

If true the method won't block. Editing the buffer while formatting asynchronous can lead to unexpected changes. (Default: false)

Opts.id : nil | integer

Restrict formatting to the client with ID (client.id) matching this field.

Opts.name : nil | string

Restrict formatting to the client with name (client.name) matching this field.

Opts.range : { end: (integer,integer), start: (integer,integer) } | { end: (integer,integer), start: (integer,integer) }[] | nil

Range to format. Table must contain start and end keys with {row,col} tuples using (1,0) indexing. The end column can be -1 to format through the end of the line. Can also be a list of tables that contain start and end keys as described above, in which case textDocument/rangesFormatting support is required. (Default: current selection in visual mode, nil in other modes, formatting the full buffer)