fix(forge): fix ghost extmarks, false auth warnings, and needless API calls

Problem: extmarks ghosted after `cc`/undo on task lines, auth warnings
fired even when CLIs were authenticated, and `refresh()` hit forge APIs
on every buffer open regardless of `auto_close`.

Solution: add `invalidate = true` to all extmarks so Neovim cleans them
up on text deletion. Run `auth status` before warning to verify the CLI
is actually unauthenticated. Gate `refresh()` behind `auto_close` config.
This commit is contained in:
Barrett Ruth 2026-03-10 23:01:33 -04:00
parent e62f2f818c
commit fe5ea8be78
2 changed files with 41 additions and 12 deletions

View file

@ -128,6 +128,7 @@ local function apply_inline_row(bufnr, row, m, icons)
vim.api.nvim_buf_set_extmark(bufnr, ns_inline, row, 0, {
end_col = #line,
hl_group = 'PendingFilter',
invalidate = true,
})
elseif m.type == 'task' then
if m.status == 'done' then
@ -136,6 +137,7 @@ local function apply_inline_row(bufnr, row, m, icons)
vim.api.nvim_buf_set_extmark(bufnr, ns_inline, row, col_start, {
end_col = #line,
hl_group = 'PendingDone',
invalidate = true,
})
elseif m.status == 'blocked' then
local line = vim.api.nvim_buf_get_lines(bufnr, row, row + 1, false)[1] or ''
@ -143,6 +145,7 @@ local function apply_inline_row(bufnr, row, m, icons)
vim.api.nvim_buf_set_extmark(bufnr, ns_inline, row, col_start, {
end_col = #line,
hl_group = 'PendingBlocked',
invalidate = true,
})
end
local line = vim.api.nvim_buf_get_lines(bufnr, row, row + 1, false)[1] or ''
@ -167,6 +170,7 @@ local function apply_inline_row(bufnr, row, m, icons)
virt_text = { { '[' .. icon .. ']', icon_hl } },
virt_text_pos = 'overlay',
priority = 100,
invalidate = true,
})
if m.forge_spans then
local forge = require('pending.forge')
@ -178,6 +182,7 @@ local function apply_inline_row(bufnr, row, m, icons)
virt_text = { { label_text, hl_group } },
virt_text_pos = 'inline',
priority = 90,
invalidate = true,
})
end
end
@ -186,11 +191,13 @@ local function apply_inline_row(bufnr, row, m, icons)
vim.api.nvim_buf_set_extmark(bufnr, ns_inline, row, 0, {
end_col = #line,
hl_group = 'PendingHeader',
invalidate = true,
})
vim.api.nvim_buf_set_extmark(bufnr, ns_inline, row, 0, {
virt_text = { { icons.category .. ' ', 'PendingHeader' } },
virt_text_pos = 'overlay',
priority = 100,
invalidate = true,
})
end
end
@ -541,6 +548,7 @@ local function apply_extmarks(bufnr, line_meta)
vim.api.nvim_buf_set_extmark(bufnr, ns_eol, row, 0, {
virt_text = virt_parts,
virt_text_pos = 'eol',
invalidate = true,
})
end
end