updates to dap and golangci-lint detection
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
local last_test = {}
|
||||
return {
|
||||
{
|
||||
'samharju/yeet.nvim',
|
||||
@ -8,14 +9,21 @@ return {
|
||||
custom_eval = function(cmd_string)
|
||||
if cmd_string:match '#test' then
|
||||
-- get current win's filetype
|
||||
local bufnr = vim.api.nvim_win_get_buf(0)
|
||||
local ft = vim.bo[bufnr].filetype
|
||||
local ft = vim.bo[0].filetype
|
||||
|
||||
if ft == 'go' then
|
||||
local dap_go = require 'dap-go-ts'
|
||||
local test = dap_go.closest_test()
|
||||
if not (test.name == nil or test.name == '') then
|
||||
last_test = test
|
||||
end
|
||||
end
|
||||
|
||||
cmd_string = cmd_string:gsub('#test', test.name)
|
||||
if next(last_test) ~= nil and not (last_test.name == nil or last_test.name == '') then
|
||||
cmd_string = cmd_string:gsub('#test', last_test.name)
|
||||
else
|
||||
vim.notify('Aborting run, no test found', vim.log.levels.WARN)
|
||||
return ''
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user