aboutsummaryrefslogtreecommitdiffstats
path: root/lua/conform
diff options
context:
space:
mode:
Diffstat (limited to 'lua/conform')
-rw-r--r--lua/conform/health.lua1
-rw-r--r--lua/conform/init.lua1
-rw-r--r--lua/conform/log.lua1
-rw-r--r--lua/conform/lsp_format.lua1
-rw-r--r--lua/conform/runner.lua5
5 files changed, 8 insertions, 1 deletions
diff --git a/lua/conform/health.lua b/lua/conform/health.lua
index 13e90d5..3ee7567 100644
--- a/lua/conform/health.lua
+++ b/lua/conform/health.lua
@@ -1,5 +1,6 @@
local M = {}
+---@diagnostic disable: deprecated
-- The "report_" functions have been deprecated, so use the new ones if defined.
local health_start = vim.health.start or vim.health.report_start
local health_warn = vim.health.warn or vim.health.report_warn
diff --git a/lua/conform/init.lua b/lua/conform/init.lua
index d6ea639..b02f890 100644
--- a/lua/conform/init.lua
+++ b/lua/conform/init.lua
@@ -1,3 +1,4 @@
+---@diagnostic disable-next-line: deprecated
local islist = vim.islist or vim.tbl_islist
local M = {}
diff --git a/lua/conform/log.lua b/lua/conform/log.lua
index b99b14c..79ca15a 100644
--- a/lua/conform/log.lua
+++ b/lua/conform/log.lua
@@ -17,6 +17,7 @@ Log.get_logfile = function()
if not ok then
stdpath = vim.fn.stdpath("cache")
end
+ assert(type(stdpath) == "string")
return fs.join(stdpath, "conform.log")
end
diff --git a/lua/conform/lsp_format.lua b/lua/conform/lsp_format.lua
index 6fa9a64..a4f9556 100644
--- a/lua/conform/lsp_format.lua
+++ b/lua/conform/lsp_format.lua
@@ -49,6 +49,7 @@ function M.get_format_clients(options)
method = method,
})
else
+ ---@diagnostic disable-next-line: deprecated
clients = vim.lsp.get_active_clients({
id = options.id,
bufnr = options.bufnr,
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