diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | doc/conform.txt | 6 | ||||
-rw-r--r-- | lua/conform/init.lua | 3 |
3 files changed, 12 insertions, 0 deletions
@@ -387,6 +387,9 @@ Format a buffer | | lsp_fallback | `nil\|boolean\|"always"` | Attempt LSP formatting if no formatters are available. Defaults to false. If "always", will attempt LSP formatting even if formatters are available (useful if you set formatters for the "*" filetype) | | | quiet | `nil\|boolean` | Don't show any notifications for warnings or failures. Defaults to false. | | | 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 | +| | id | `nil\|integer` | Passed to vim.lsp.buf.format when lsp_fallback = true | +| | name | `nil\|string` | Passed to vim.lsp.buf.format when lsp_fallback = true | +| | filter | `nil\|fun(client: table): boolean` | Passed to vim.lsp.buf.format when lsp_fallback = true | | callback | `nil\|fun(err: nil\|string)` | Called once formatting has completed | | Returns: diff --git a/doc/conform.txt b/doc/conform.txt index a62eca8..0052326 100644 --- a/doc/conform.txt +++ b/doc/conform.txt @@ -115,6 +115,12 @@ format({opts}, {callback}): boolean *conform.forma {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 + {id} `nil|integer` Passed to |vim.lsp.buf.format| when + lsp_fallback = true + {name} `nil|string` Passed to |vim.lsp.buf.format| when + lsp_fallback = true + {filter} `nil|fun(client: table): boolean` Passed to + |vim.lsp.buf.format| when lsp_fallback = true {callback} `nil|fun(err: nil|string)` Called once formatting has completed Returns: `boolean` True if any formatters were attempted diff --git a/lua/conform/init.lua b/lua/conform/init.lua index 3245020..378822f 100644 --- a/lua/conform/init.lua +++ b/lua/conform/init.lua @@ -258,6 +258,9 @@ end --- lsp_fallback nil|boolean|"always" Attempt LSP formatting if no formatters are available. Defaults to false. If "always", will attempt LSP formatting even if formatters are available (useful if you set formatters for the "*" filetype) --- quiet nil|boolean Don't show any notifications for warnings or failures. Defaults to false. --- 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 +--- id nil|integer Passed to |vim.lsp.buf.format| when lsp_fallback = true +--- name nil|string Passed to |vim.lsp.buf.format| when lsp_fallback = true +--- filter nil|fun(client: table): boolean Passed to |vim.lsp.buf.format| when lsp_fallback = true ---@param callback? fun(err: nil|string) Called once formatting has completed ---@return boolean True if any formatters were attempted M.format = function(opts, callback) |