fix(ci): format
This commit is contained in:
parent
d40d80c541
commit
c8c0da6d61
3 changed files with 9 additions and 18 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -1,11 +1,16 @@
|
||||||
.venv/
|
.venv
|
||||||
|
venv
|
||||||
doc/tags
|
doc/tags
|
||||||
*.log
|
*.log
|
||||||
build
|
build
|
||||||
io
|
io
|
||||||
debug
|
debug
|
||||||
venv/
|
create
|
||||||
|
|
||||||
|
|
||||||
|
.*cache*
|
||||||
CLAUDE.md
|
CLAUDE.md
|
||||||
__pycache__
|
__pycache__
|
||||||
.claude/
|
.claude/
|
||||||
|
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: prettier
|
- id: prettier
|
||||||
name: prettier
|
name: prettier
|
||||||
|
files: \.(md|,toml,yaml,sh)$
|
||||||
|
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
|
|
|
||||||
|
|
@ -255,34 +255,27 @@ local function get_or_create_io_buffers()
|
||||||
vim.api.nvim_create_autocmd({ 'BufWinEnter', 'BufWinLeave' }, {
|
vim.api.nvim_create_autocmd({ 'BufWinEnter', 'BufWinLeave' }, {
|
||||||
group = group_name,
|
group = group_name,
|
||||||
buffer = source_buf,
|
buffer = source_buf,
|
||||||
callback = function(ev)
|
callback = function()
|
||||||
logger.log(('autocmd %s fired for source_buf=%s'):format(ev.event, source_buf))
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
local io = state.get_io_view_state()
|
local io = state.get_io_view_state()
|
||||||
if not io then
|
if not io then
|
||||||
logger.log('autocmd scheduled: no io_state, returning')
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if io.source_buf ~= source_buf then
|
if io.source_buf ~= source_buf then
|
||||||
logger.log(('autocmd scheduled: source_buf mismatch (autocmd=%s, io_state=%s), returning'):format(
|
|
||||||
source_buf, io.source_buf))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local wins = vim.api.nvim_list_wins()
|
local wins = vim.api.nvim_list_wins()
|
||||||
for _, win in ipairs(wins) do
|
for _, win in ipairs(wins) do
|
||||||
if vim.api.nvim_win_get_buf(win) == source_buf then
|
if vim.api.nvim_win_get_buf(win) == source_buf then
|
||||||
logger.log(('autocmd scheduled: source_buf=%s visible in win=%s, returning'):format(source_buf, win))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
logger.log(('autocmd scheduled: source_buf=%s NOT visible, closing io windows'):format(source_buf))
|
|
||||||
for _, win in ipairs(wins) do
|
for _, win in ipairs(wins) do
|
||||||
local buf = vim.api.nvim_win_get_buf(win)
|
local buf = vim.api.nvim_win_get_buf(win)
|
||||||
if buf == io.output_buf or buf == io.input_buf then
|
if buf == io.output_buf or buf == io.input_buf then
|
||||||
logger.log(('autocmd scheduled: closing win=%s with buf=%s'):format(win, buf))
|
|
||||||
if #vim.api.nvim_list_wins() > 1 then
|
if #vim.api.nvim_list_wins() > 1 then
|
||||||
pcall(vim.api.nvim_win_close, win, true)
|
pcall(vim.api.nvim_win_close, win, true)
|
||||||
else
|
else
|
||||||
|
|
@ -382,7 +375,6 @@ local function create_window_layout(output_buf, input_buf)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.ensure_io_view()
|
function M.ensure_io_view()
|
||||||
logger.log('ensure_io_view: starting')
|
|
||||||
local platform, contest_id, problem_id =
|
local platform, contest_id, problem_id =
|
||||||
state.get_platform(), state.get_contest_id(), state.get_problem_id()
|
state.get_platform(), state.get_contest_id(), state.get_problem_id()
|
||||||
if not platform or not contest_id or not problem_id then
|
if not platform or not contest_id or not problem_id then
|
||||||
|
|
@ -394,7 +386,6 @@ function M.ensure_io_view()
|
||||||
end
|
end
|
||||||
|
|
||||||
local source_file = state.get_source_file()
|
local source_file = state.get_source_file()
|
||||||
logger.log(('ensure_io_view: source_file=%s'):format(source_file or 'nil'))
|
|
||||||
if source_file then
|
if source_file then
|
||||||
local source_file_abs = vim.fn.fnamemodify(source_file, ':p')
|
local source_file_abs = vim.fn.fnamemodify(source_file, ':p')
|
||||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||||
|
|
@ -402,7 +393,6 @@ function M.ensure_io_view()
|
||||||
local buf_name = vim.api.nvim_buf_get_name(buf)
|
local buf_name = vim.api.nvim_buf_get_name(buf)
|
||||||
if buf_name == source_file_abs then
|
if buf_name == source_file_abs then
|
||||||
state.set_solution_win(win)
|
state.set_solution_win(win)
|
||||||
logger.log(('ensure_io_view: found solution_win=%s for buf=%s'):format(win, buf))
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -422,22 +412,17 @@ function M.ensure_io_view()
|
||||||
end
|
end
|
||||||
|
|
||||||
local output_buf, input_buf = get_or_create_io_buffers()
|
local output_buf, input_buf = get_or_create_io_buffers()
|
||||||
logger.log(('ensure_io_view: got buffers output=%s input=%s'):format(output_buf, input_buf))
|
|
||||||
|
|
||||||
if not buffers_are_displayed(output_buf, input_buf) then
|
if not buffers_are_displayed(output_buf, input_buf) then
|
||||||
local solution_win = state.get_solution_win()
|
local solution_win = state.get_solution_win()
|
||||||
logger.log(('ensure_io_view: buffers not displayed, closing non-solution windows (solution_win=%s)'):format(solution_win))
|
|
||||||
|
|
||||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||||
if win ~= solution_win then
|
if win ~= solution_win then
|
||||||
logger.log(('ensure_io_view: closing win=%s'):format(win))
|
|
||||||
pcall(vim.api.nvim_win_close, win, true)
|
pcall(vim.api.nvim_win_close, win, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
create_window_layout(output_buf, input_buf)
|
create_window_layout(output_buf, input_buf)
|
||||||
else
|
|
||||||
logger.log('ensure_io_view: buffers already displayed, skipping layout creation')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local cfg = config_module.get_config()
|
local cfg = config_module.get_config()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue