diff options
author | Micah Halter <micah@mehalter.com> | 2024-06-19 22:23:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-19 22:23:16 -0400 |
commit | 9a06e83527407a7600a2fe4e0d10adf432b6215e (patch) | |
tree | df05a50b789471da27e9c17da9aedce7a3b799c2 /lua/conform/init.lua | |
parent | bde3bee1773c96212b6c49f009e05174f932c23a (diff) |
doc: add LSP annotations for `lsp_format` options (#461)
* doc: add LSP annotations for `lsp_format` options
* doc: regenerate documentation
---------
Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
Diffstat (limited to 'lua/conform/init.lua')
-rw-r--r-- | lua/conform/init.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lua/conform/init.lua b/lua/conform/init.lua index 0bab347..aa97f1c 100644 --- a/lua/conform/init.lua +++ b/lua/conform/init.lua @@ -328,13 +328,20 @@ local function has_lsp_formatter(opts) return not vim.tbl_isempty(lsp_format.get_format_clients(opts)) end +---@alias conform.LspFormatOpts +---| '"never"' # never use the LSP for formatting (default) +---| '"fallback"' # LSP formatting is used when no other formatters are available +---| '"prefer"' # use only LSP formatting when available +---| '"first"' # LSP formatting is used when available and then other formatters +---| '"last"' # other formatters are used then LSP formatting when available + ---@class conform.FormatOpts ---@field timeout_ms nil|integer Time in milliseconds to block for formatting. Defaults to 1000. No effect if async = true. ---@field bufnr nil|integer Format this buffer (default 0) ---@field async nil|boolean If true the method won't block. Defaults to false. If the buffer is modified before the formatter completes, the formatting will be discarded. ---@field dry_run nil|boolean If true don't apply formatting changes to the buffer ---@field formatters nil|string[] List of formatters to run. Defaults to all formatters for the buffer filetype. ----@field lsp_format? "never"|"fallback"|"prefer"|"first"|"last" "fallback" LSP formatting when no other formatters are available, "prefer" only LSP formatting when available, "first" LSP formatting then other formatters, "last" other formatters then LSP. +---@field lsp_format? conform.LspFormatOpts Configure if and when LSP should be used for formatting. Defaults to "never". ---@field quiet nil|boolean Don't show any notifications for warnings or failures. Defaults to false. ---@field range nil|table Range to format. Table must contain `start` and `end` keys with {row, col} tuples using (1,0) indexing. Defaults to current selection in visual mode ---@field id nil|integer Passed to |vim.lsp.buf.format| when using LSP formatting |