Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 0.11-nightly warnings of deprecated functions #94

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lua/neotest-go/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function adapter._generate_position_id(position, namespaces)
end
end
local name = utils.transform_test_name(position.name)
return table.concat(vim.tbl_flatten({ position.path, prefix, name }), "::")
return table.concat(utils.tbl_flatten({ position.path, prefix, name }), "::")
end

---@async
Expand Down Expand Up @@ -162,7 +162,7 @@ function adapter.build_spec(args)
if fn.isdirectory(position.path) ~= 1 then
location = fn.fnamemodify(position.path, ":h")
end
local command = vim.tbl_flatten({
local command = utils.tbl_flatten({
"cd",
location,
"&&",
Expand All @@ -175,14 +175,14 @@ function adapter.build_spec(args)
dir,
})
local return_result = {
command = table.concat(command, ' '),
command = table.concat(command, " "),
context = {
results_path = results_path,
file = position.path
}
file = position.path,
},
}

if strategy == 'dap' then
if strategy == "dap" then
return_result.strategy = utils.get_dap_config()
end

Expand Down
17 changes: 12 additions & 5 deletions lua/neotest-go/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ end
---@return table | nil
function utils.get_dap_config()
return {
type = 'go',
name = 'Neotest Debugger',
request = 'launch',
mode = 'test',
program = './${relativeFileDirname}',
type = "go",
name = "Neotest Debugger",
request = "launch",
mode = "test",
program = "./${relativeFileDirname}",
}
end

Expand Down Expand Up @@ -183,4 +183,11 @@ function utils.get_prefix(tree, name)
return parent_name .. "/" .. name
end

---@param t table
---@return table
function utils.tbl_flatten(t)
return vim.fn.has("nvim-0.11") == 1 and vim.iter(t):flatten(math.huge):totable()
or vim.tbl_flatten(t)
end

return utils