aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorBronson Jordan <80419011+bpjordan@users.noreply.github.com>2024-01-15 21:48:26 -0600
committerGitHub <noreply@github.com>2024-01-15 19:48:26 -0800
commite0276bb32e9b33ece11fef2a5cfc8fb2108df0df (patch)
treea8b9bb0a2c16ab85f2ce74c198de3b6965424451 /README.md
parent75e7c5c7eb5fbd53f8b12dc420b31ec70770b231 (diff)
feat: Add dry_run option and report if buffer was/would be changed by formatters (#273)
* feat: add dry_run option and pass return values for if buffer would be modified * fix: implement dry_run for blocking calls to lsp formatter * refactor: change `changed` variable to `did_edit` * docs: Update README * fix: address PR comments * fix: small cleanups --------- Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
Diffstat (limited to 'README.md')
-rw-r--r--README.md29
1 files changed, 15 insertions, 14 deletions
diff --git a/README.md b/README.md
index 6e16696..893a8ec 100644
--- a/README.md
+++ b/README.md
@@ -502,20 +502,21 @@ require("conform").formatters.my_formatter = {
`format(opts, callback): boolean` \
Format a buffer
-| Param | Type | Desc | |
-| -------- | ---------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
-| opts | `nil\|table` | | |
-| | timeout_ms | `nil\|integer` | Time in milliseconds to block for formatting. Defaults to 1000. No effect if async = true. |
-| | bufnr | `nil\|integer` | Format this buffer (default 0) |
-| | 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. |
-| | formatters | `nil\|string[]` | List of formatters to run. Defaults to all formatters for the buffer filetype. |
-| | 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. |
-| | 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 | |
+| Param | Type | Desc | |
+| -------- | ---------------------------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
+| opts | `nil\|table` | | |
+| | timeout_ms | `nil\|integer` | Time in milliseconds to block for formatting. Defaults to 1000. No effect if async = true. |
+| | bufnr | `nil\|integer` | Format this buffer (default 0) |
+| | 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. |
+| | dry_run | `nil\|boolean` | If true don't apply formatting changes to the buffer |
+| | formatters | `nil\|string[]` | List of formatters to run. Defaults to all formatters for the buffer filetype. |
+| | 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. |
+| | 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, did_edit: nil\|boolean)` | Called once formatting has completed | |
Returns: