Skip to content

Commit

Permalink
Fix compat function to work in async
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed May 31, 2024
1 parent d136011 commit 1208a02
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lua/obsidian/compat.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
local compat = {}

local has_nvim_0_11 = false
if vim.fn.has "nvim-0.11" == 1 then
has_nvim_0_11 = true
end

compat.is_list = function(t)
if vim.fn.has "nvim-0.11" == 1 then
if has_nvim_0_11 then
return vim.islist(t)
else
return vim.tbl_islist(t)
end
end

compat.flatten = function(t)
if vim.fn.has "nvim-0.11" == 1 then
if has_nvim_0_11 then
---@diagnostic disable-next-line: undefined-field
return vim.iter(t):flatten():totable()
else
return vim.tbl_flatten(t)
Expand Down

0 comments on commit 1208a02

Please sign in to comment.