aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/conform/health.lua3
-rw-r--r--lua/conform/init.lua5
-rw-r--r--lua/conform/util.lua8
3 files changed, 11 insertions, 5 deletions
diff --git a/lua/conform/health.lua b/lua/conform/health.lua
index c02fd00..13e90d5 100644
--- a/lua/conform/health.lua
+++ b/lua/conform/health.lua
@@ -5,6 +5,7 @@ local health_start = vim.health.start or vim.health.report_start
local health_warn = vim.health.warn or vim.health.report_warn
local health_info = vim.health.info or vim.health.report_info
local health_ok = vim.health.ok or vim.health.report_ok
+local islist = vim.islist or vim.tbl_islist
---@param name string
---@return string[]
@@ -15,7 +16,7 @@ local function get_formatter_filetypes(name)
if type(formatters) == "function" then
formatters = formatters(0)
-- support the old structure where formatters could be a subkey
- elseif not vim.tbl_islist(formatters) then
+ elseif not islist(formatters) then
vim.notify_once(
"Using deprecated structure for formatters_by_ft. See :help conform-options for details.",
vim.log.levels.ERROR
diff --git a/lua/conform/init.lua b/lua/conform/init.lua
index 2412445..435e009 100644
--- a/lua/conform/init.lua
+++ b/lua/conform/init.lua
@@ -1,3 +1,4 @@
+local islist = vim.islist or vim.tbl_islist
local M = {}
---@class (exact) conform.FormatterInfo
@@ -266,7 +267,7 @@ M.list_formatters_for_buffer = function(bufnr)
dedupe_formatters(ft_formatters(bufnr), formatters)
else
-- support the old structure where formatters could be a subkey
- if not vim.tbl_islist(ft_formatters) then
+ if not islist(ft_formatters) then
vim.notify_once(
"Using deprecated structure for formatters_by_ft. See :help conform-options for details.",
vim.log.levels.ERROR
@@ -534,7 +535,7 @@ M.list_all_formatters = function()
ft_formatters = ft_formatters(0)
end
-- support the old structure where formatters could be a subkey
- if not vim.tbl_islist(ft_formatters) then
+ if not islist(ft_formatters) then
vim.notify_once(
"Using deprecated structure for formatters_by_ft. See :help conform-options for details.",
vim.log.levels.ERROR
diff --git a/lua/conform/util.lua b/lua/conform/util.lua
index e967918..950bdae 100644
--- a/lua/conform/util.lua
+++ b/lua/conform/util.lua
@@ -133,11 +133,15 @@ M.extend_args = function(args, extra_args, opts)
if type(extra_args) == "string" then
error("extra_args must be a table when args is a table")
end
+ local ret = {}
if opts.append then
- return vim.tbl_flatten({ args, extra_args })
+ vim.list_extend(ret, args)
+ vim.list_extend(ret, extra_args)
else
- return vim.tbl_flatten({ extra_args, args })
+ vim.list_extend(ret, extra_args)
+ vim.list_extend(ret, args)
end
+ return ret
end
end
end