FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore: handle deprecated `vim.tbl_flatten` · nvim-flutter/flutter-tools.nvim@33538b6 · GitHub

Commit 33538b6

Browse files
committed
chore: handle deprecated vim.tbl_flatten
1 parent fcf2720 commit 33538b6

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎lua/flutter-tools/executable.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ local function _dart_sdk_root(paths)
2727
if path.is_dir(path.join(unpack(segments))) then
2828
-- remove the /cache/ directory as it's already part of the SDK path above
2929
segments[#segments] = nil
30-
return path.join(unpack(vim.tbl_flatten({ segments, dart_sdk })))
30+
return path.join(unpack(utils.flatten({ segments, dart_sdk })))
3131
end
3232
end
3333

‎lua/flutter-tools/utils/init.lua‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,7 @@ end
143143

144144
-- TODO: Remove after compatibility with Neovim=0.9 is dropped
145145
M.islist = vim.fn.has("nvim-0.10") == 1 and vim.islist or vim.tbl_islist
146+
local flatten = function(t) return vim.iter(t):flatten():totable() end
147+
M.flatten = vim.fn.has("nvim-0.10") == 1 and flatten or vim.tbl_flatten
146148

147149
return M

‎lua/flutter-tools/utils/path.lua‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
-- Some path utilities, copied from nvim-lsp config
2+
local lazy = require("flutter-tools.lazy")
3+
local utils = lazy.require("flutter-tools.utils") ---@module "flutter-tools.utils"
24

35
local luv = vim.loop
46
local M = {}
@@ -51,7 +53,7 @@ end
5153
---@return string
5254
function M.join(...)
5355
local result =
54-
table.concat(vim.tbl_flatten({ ... }), M.path_sep):gsub(M.path_sep .. "+", M.path_sep)
56+
table.concat(utils.flatten({ ... }), M.path_sep):gsub(M.path_sep .. "+", M.path_sep)
5557
return result
5658
end
5759

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL