From c6e2d969b89084a80bb1f91e3a5d48d49ef79619 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 16 May 2024 21:55:18 +0200 Subject: [PATCH] fix: deprecation warnings on 0.11 --- lua/neoconf/build/schemas.lua | 2 +- lua/neoconf/schema.lua | 3 ++- lua/neoconf/util.lua | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/neoconf/build/schemas.lua b/lua/neoconf/build/schemas.lua index 85eafed..ca94f5e 100644 --- a/lua/neoconf/build/schemas.lua +++ b/lua/neoconf/build/schemas.lua @@ -96,7 +96,7 @@ function M.get_schema(schema) local properties = {} - if vim.tbl_islist(config) then + if Util.islist(config) then for _, c in pairs(config) do vim.list_extend(properties, c.properties) end diff --git a/lua/neoconf/schema.lua b/lua/neoconf/schema.lua index c553cf6..4d37b4d 100644 --- a/lua/neoconf/schema.lua +++ b/lua/neoconf/schema.lua @@ -1,4 +1,5 @@ local Settings = require("neoconf.settings") +local Util = require("neoconf.util") local M = {} @@ -57,7 +58,7 @@ function M.to_schema(value) return { type = "number", default = value, description = "number" } end - if vim.tbl_islist(value) then + if Util.islist(value) then return { type = "array", default = value, description = "array" } end diff --git a/lua/neoconf/util.lua b/lua/neoconf/util.lua index 96ca3d0..954a162 100644 --- a/lua/neoconf/util.lua +++ b/lua/neoconf/util.lua @@ -2,9 +2,11 @@ local Config = require("neoconf.config") local M = {} +M.islist = vim.islist or vim.tbl_islist + function M.merge(...) local function can_merge(v) - return type(v) == "table" and (vim.tbl_isempty(v) or not vim.tbl_islist(v)) + return type(v) == "table" and (vim.tbl_isempty(v) or not M.islist(v)) end local values = { ... }