aboutsummaryrefslogtreecommitdiffstats
path: root/lua/conform/runner.lua
diff options
context:
space:
mode:
authorSteven Arcangeli <stevearc@stevearc.com>2024-05-16 10:36:20 -0700
committerSteven Arcangeli <stevearc@stevearc.com>2024-05-16 10:36:20 -0700
commitaf6a2e732d2dfdf174fb2ca1518a72814fd106cf (patch)
treea5c90613c35aeea666ca345bf7d7329a97c8854b /lua/conform/runner.lua
parent59d0dd233a2cafacfa1235ab22054c4d80a72319 (diff)
ci: test against Neovim 0.10
Diffstat (limited to 'lua/conform/runner.lua')
-rw-r--r--lua/conform/runner.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/lua/conform/runner.lua b/lua/conform/runner.lua
index 1fbb33c..fd99807 100644
--- a/lua/conform/runner.lua
+++ b/lua/conform/runner.lua
@@ -169,6 +169,9 @@ end
---@param only_apply_range boolean
---@return boolean any_changes
M.apply_format = function(bufnr, original_lines, new_lines, range, only_apply_range, dry_run)
+ if bufnr == 0 then
+ bufnr = vim.api.nvim_get_current_buf()
+ end
if not vim.api.nvim_buf_is_valid(bufnr) then
return false
end
@@ -197,7 +200,7 @@ M.apply_format = function(bufnr, original_lines, new_lines, range, only_apply_ra
result_type = "indices",
algorithm = "histogram",
})
- assert(indices)
+ assert(type(indices) == "table")
log.trace("Diff indices %s", indices)
local text_edits = {}
for _, idx in ipairs(indices) do