From 27e16f7734e43502f4375d7974c4df186bfef872 Mon Sep 17 00:00:00 2001 From: Paul Brittain Date: Fri, 30 May 2025 10:19:50 +0200 Subject: [PATCH] fix: use vim.iter(...):flatten():totable() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fixes: 'Warning: vim.tbl_flatten is deprecated, use vim.iter(…):flatten():totable() instead.' - replaces usage of vim.tbl_flatten() while keeping backward compatibility for < v0.10.0. --- lua/telescope/_extensions/file_browser/fs_stat.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/telescope/_extensions/file_browser/fs_stat.lua b/lua/telescope/_extensions/file_browser/fs_stat.lua index c315d5cd..fa49842c 100644 --- a/lua/telescope/_extensions/file_browser/fs_stat.lua +++ b/lua/telescope/_extensions/file_browser/fs_stat.lua @@ -68,12 +68,21 @@ M.mode = { right_justify = true, display = function(entry) local owner, group, other = string.format("%3o", entry.stat.mode):match "(.)(.)(.)$" - local stat = vim.tbl_flatten { + + local stat = { mode_type_map[entry.lstat.type] or "-", mode_perm_map[owner], mode_perm_map[group], mode_perm_map[other], } + + -- TODO: remove when dropping support for Nvim 0.9 + if vim.fn.has "nvim-0.10" == 1 then + stat = vim.iter(stat):flatten():totable() + else + stat = vim.tbl_flatten(stat) + end + local highlights = {} for i, char in ipairs(stat) do local hl = color_hash[char]