ci: format
This commit is contained in:
parent
0e88e0f182
commit
72ea6249f4
3 changed files with 24 additions and 12 deletions
|
|
@ -169,15 +169,15 @@ M.defaults = {
|
|||
hooks = {
|
||||
setup = {
|
||||
contest = nil,
|
||||
code = nil,
|
||||
code = nil,
|
||||
io = {
|
||||
input = helpers.clearcol,
|
||||
input = helpers.clearcol,
|
||||
output = helpers.clearcol,
|
||||
},
|
||||
},
|
||||
on = {
|
||||
enter = nil,
|
||||
run = nil,
|
||||
run = nil,
|
||||
debug = nil,
|
||||
},
|
||||
},
|
||||
|
|
@ -376,12 +376,12 @@ function M.setup(user_config)
|
|||
vim.validate({ setup = { cfg.hooks.setup, 'table' } })
|
||||
vim.validate({
|
||||
contest = { cfg.hooks.setup.contest, { 'function', 'nil' }, true },
|
||||
code = { cfg.hooks.setup.code, { 'function', 'nil' }, true },
|
||||
code = { cfg.hooks.setup.code, { 'function', 'nil' }, true },
|
||||
})
|
||||
if cfg.hooks.setup.io ~= nil then
|
||||
vim.validate({ io = { cfg.hooks.setup.io, 'table' } })
|
||||
vim.validate({
|
||||
input = { cfg.hooks.setup.io.input, { 'function', 'nil' }, true },
|
||||
input = { cfg.hooks.setup.io.input, { 'function', 'nil' }, true },
|
||||
output = { cfg.hooks.setup.io.output, { 'function', 'nil' }, true },
|
||||
})
|
||||
end
|
||||
|
|
@ -390,7 +390,7 @@ function M.setup(user_config)
|
|||
vim.validate({ on = { cfg.hooks.on, 'table' } })
|
||||
vim.validate({
|
||||
enter = { cfg.hooks.on.enter, { 'function', 'nil' }, true },
|
||||
run = { cfg.hooks.on.run, { 'function', 'nil' }, true },
|
||||
run = { cfg.hooks.on.run, { 'function', 'nil' }, true },
|
||||
debug = { cfg.hooks.on.debug, { 'function', 'nil' }, true },
|
||||
})
|
||||
end
|
||||
|
|
|
|||
|
|
@ -306,7 +306,9 @@ function M.setup_problem(problem_id, language)
|
|||
local s = config.hooks and config.hooks.setup
|
||||
if s and s.code then
|
||||
local ok = pcall(s.code, state)
|
||||
if ok then vim.b[prov.bufnr].cp_setup_done = true end
|
||||
if ok then
|
||||
vim.b[prov.bufnr].cp_setup_done = true
|
||||
end
|
||||
else
|
||||
helpers.clearcol(prov.bufnr)
|
||||
vim.b[prov.bufnr].cp_setup_done = true
|
||||
|
|
@ -316,7 +318,9 @@ function M.setup_problem(problem_id, language)
|
|||
local bufnr = prov.bufnr
|
||||
vim.api.nvim_create_autocmd('BufEnter', {
|
||||
buffer = bufnr,
|
||||
callback = function() pcall(o.enter, state) end,
|
||||
callback = function()
|
||||
pcall(o.enter, state)
|
||||
end,
|
||||
})
|
||||
pcall(o.enter, state)
|
||||
end
|
||||
|
|
@ -351,7 +355,9 @@ function M.setup_problem(problem_id, language)
|
|||
local s = config.hooks and config.hooks.setup
|
||||
if s and s.code then
|
||||
local ok = pcall(s.code, state)
|
||||
if ok then vim.b[bufnr].cp_setup_done = true end
|
||||
if ok then
|
||||
vim.b[bufnr].cp_setup_done = true
|
||||
end
|
||||
else
|
||||
helpers.clearcol(bufnr)
|
||||
vim.b[bufnr].cp_setup_done = true
|
||||
|
|
@ -360,7 +366,9 @@ function M.setup_problem(problem_id, language)
|
|||
if o and o.enter then
|
||||
vim.api.nvim_create_autocmd('BufEnter', {
|
||||
buffer = bufnr,
|
||||
callback = function() pcall(o.enter, state) end,
|
||||
callback = function()
|
||||
pcall(o.enter, state)
|
||||
end,
|
||||
})
|
||||
pcall(o.enter, state)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -960,10 +960,14 @@ function M.toggle_panel(panel_opts)
|
|||
|
||||
local o = config.hooks and config.hooks.on
|
||||
if o and o.run then
|
||||
vim.schedule(function() o.run(state) end)
|
||||
vim.schedule(function()
|
||||
o.run(state)
|
||||
end)
|
||||
end
|
||||
if panel_opts and panel_opts.debug and o and o.debug then
|
||||
vim.schedule(function() o.debug(state) end)
|
||||
vim.schedule(function()
|
||||
o.debug(state)
|
||||
end)
|
||||
end
|
||||
|
||||
vim.api.nvim_set_current_win(test_windows.tab_win)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue