aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorSteven Arcangeli <stevearc@stevearc.com>2023-08-28 18:28:07 -0700
committerSteven Arcangeli <stevearc@stevearc.com>2023-08-28 18:28:07 -0700
commitcddd536e087a9fd3d2c9ea5b0a44e46c7b4b54c2 (patch)
tree70f6868440596ae90b7f451379c3abfa5678849c /doc
parent69c4495ab5ad3c07c3a4f3c2bcac2f070718b4cb (diff)
feat: range formatting
Should work the same as vim.lsp.buf.format(). Additionally, range formatting is supported for *any* formatter. If the formatter doesn't have native support for ranges, conform will do its best to only apply the diffs that affect that range.
Diffstat (limited to 'doc')
-rw-r--r--doc/conform.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/conform.txt b/doc/conform.txt
index f602580..f0b97a0 100644
--- a/doc/conform.txt
+++ b/doc/conform.txt
@@ -44,6 +44,10 @@ OPTIONS *conform-option
-- OPTIONAL - all fields below this are optional
-- A list of strings, or a function that returns a list of strings
args = { "--stdin-from-filename", "$FILENAME" },
+ -- If the formatter supports range formatting, create the range arguments here
+ range_args = function(ctx)
+ return { "--line-start", ctx.range.start[1], "--line-end", ctx.range["end"][1] }
+ end,
-- Send file contents to stdin, read new contents from stdout (default true)
-- When false, will create a temp file (will appear in "$FILENAME" args). The temp
-- file is assumed to be modified in-place by the format command.
@@ -95,6 +99,9 @@ format({opts}): boolean *conform.forma
are available. Defaults to false.
{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
Returns:
`boolean` True if any formatters were attempted