Skip to content

Commit

Permalink
fix(util): deprecation warnings for tbl_islist
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent 5b868fa commit 7577f3a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lua/trouble/command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function M.complete_opts()
end
local kk = top.k .. k
candidates[#candidates + 1] = kk:gsub("^%.", "") .. "="
if type(v) == "table" and not vim.tbl_islist(v) then
if type(v) == "table" and not Util.islist(v) then
table.insert(stack, { k = kk, t = v })
end
end
Expand Down
2 changes: 1 addition & 1 deletion lua/trouble/format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function M.field(ctx)
if not result then
return
end
result = type(result) == "table" and vim.tbl_islist(result) and result or { result }
result = type(result) == "table" and Util.islist(result) and result or { result }
format = {}
---@cast result (string|trouble.Format)[]
for _, f in ipairs(result) do
Expand Down
3 changes: 2 additions & 1 deletion lua/trouble/spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local Config = require("trouble.config")
local Util = require("trouble.util")

---@alias trouble.SorterFn fun(item: trouble.Item): any?

Expand Down Expand Up @@ -103,7 +104,7 @@ end
---@param spec trouble.Sort.spec
---@return trouble.Sort[]
function M.sort(spec)
spec = type(spec) == "table" and vim.tbl_islist(spec) and spec or { spec }
spec = type(spec) == "table" and Util.islist(spec) and spec or { spec }
---@cast spec (string|trouble.SorterFn|trouble.Filter.spec)[]
local fields = {} ---@type trouble.Sort[]
for f, field in ipairs(spec) do
Expand Down
2 changes: 2 additions & 0 deletions lua/trouble/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ function M.try(fn, opts)
end
end

M.islist = vim.islist or vim.tbl_islist

---@alias NotifyOpts {level?: number, title?: string, once?: boolean}

---@param msg string|string[]
Expand Down

0 comments on commit 7577f3a

Please sign in to comment.