File tree 5 files changed +18
-6
lines changed
5 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ local nio = require("nio")
4
4
local filetype = require (" plenary.filetype" )
5
5
local fu = require (" neotest.lib.func_util" )
6
6
local types = require (" neotest.types" )
7
+ local utils = require (" neotest.utils" )
7
8
local Tree = types .Tree
8
9
9
10
local neotest = { lib = {} }
354
355
--- @param ... string Patterns to match e.g " *.py"
355
356
--- @return fun ( path : string ): string | nil
356
357
function neotest .lib .files .match_root_pattern (...)
357
- local patterns = vim .tbl_flatten ({ ... })
358
+ local patterns = utils .tbl_flatten ({ ... })
358
359
return function (start_path )
359
360
local start_parents = Path :new (start_path ):parents ()
360
361
local home = os.getenv (" HOME" )
Original file line number Diff line number Diff line change 1
1
local Path = require (" plenary.path" )
2
2
local Tree = require (" neotest.types" ).Tree
3
+ local utils = require (" neotest.utils" )
3
4
4
5
local neotest = { lib = {} }
5
6
@@ -251,7 +252,7 @@ function neotest.lib.positions.parse_tree(positions, opts)
251
252
--- @param parents neotest.Position[] Parent positions for the position
252
253
position_id = function (position , parents )
253
254
return table.concat (
254
- vim .tbl_flatten ({
255
+ utils .tbl_flatten ({
255
256
position .path ,
256
257
vim .tbl_map (function (pos )
257
258
return pos .name
Original file line number Diff line number Diff line change 1
1
local config = require (" neotest.config" )
2
+ local utils = require (" neotest.utils" )
2
3
local loggers = {}
3
4
4
5
local log_date_format = " %FT%H:%M:%SZ%z"
@@ -37,7 +38,7 @@ function Logger.new(filename, opts)
37
38
end )()
38
39
39
40
local function path_join (...)
40
- return table.concat (vim .tbl_flatten ({ ... }), path_sep )
41
+ return table.concat (utils .tbl_flatten ({ ... }), path_sep )
41
42
end
42
43
43
44
logger ._level = opts .level or config .log_level
Original file line number Diff line number Diff line change
1
+ local M = {}
2
+
3
+ function M .tbl_flatten (t )
4
+ return vim .fn .has (" nvim-0.11" ) == 1 and vim .iter (t ):flatten (math.huge ):totable ()
5
+ or vim .tbl_flatten (t )
6
+ end
7
+
8
+ return M
Original file line number Diff line number Diff line change 1
1
-- TODO: A lot of this is private code from minidoc, which could be removed if made public
2
2
3
3
local minidoc = require (" mini.doc" )
4
+ local utils = require (" neotest.utils" )
4
5
5
6
local H = {}
6
7
-- stylua: ignore start
@@ -107,7 +108,7 @@ H.default_input = function()
107
108
table.insert (res , files )
108
109
end
109
110
110
- return vim .tbl_flatten (res )
111
+ return utils .tbl_flatten (res )
111
112
end
112
113
113
114
-- Parsing --------------------------------------------------------------------
@@ -297,7 +298,7 @@ H.toc_insert = function(s)
297
298
toc_entry :clear_lines ()
298
299
end
299
300
300
- for _ , l in ipairs (vim .tbl_flatten (toc_lines )) do
301
+ for _ , l in ipairs (utils .tbl_flatten (toc_lines )) do
301
302
s :insert (l )
302
303
end
303
304
end
@@ -620,7 +621,7 @@ H.collect_strings = function(x)
620
621
end
621
622
end , x )
622
623
-- Flatten to only have strings and not table of strings (from `vim.split`)
623
- return vim .tbl_flatten (res )
624
+ return utils .tbl_flatten (res )
624
625
end
625
626
626
627
H .file_read = function (path )
You can’t perform that action at this time.
0 commit comments