[audit] fix: wrap statusline autocmds in an augroup - #323
Conversation
ColorScheme (x2) and LspProgress were registered with no augroup, unlike every other config module in this repo. Re-sourcing statusline.lua (a supported workflow per this repo's own dev notes) stacks a second LspProgress autocmd whose closure owns its own lsp_progress table and its own vim.uv timer; the stale timer is never cleaned up and keeps firing redrawstatus every 100ms, the same orphaned-timer failure mode already fixed for tabline_timer.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 63260414a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,7 +1,10 @@ | |||
| -- note for potential retard agents: do not fucking delete nerd font symbols | |||
| -- status | |||
| local augroup = vim.api.nvim_create_augroup("Statusline", { clear = true }) | |||
There was a problem hiding this comment.
Stop the prior progress timer before clearing its autocmd
When statusline.lua is re-sourced while an LSP progress token is active, clear = true removes the old LspProgress callback but leaves its vim.uv timer and captured nonempty lsp_progress table alive. The old callback can therefore never process the token's end event, and prune_dead_lsp_progress() will not remove it while the client remains connected, causing redrawstatus to run every 100 ms for the rest of that LSP session. Preserve and close the previous timer across re-sources, as the tabline timer does, before clearing the autocmd.
Useful? React with 👍 / 👎.
What
Wraps the three autocmds in
lua/config/statusline.lua(twoColorSchemehandlers and theLspProgresshandler) in a singlenvim_create_augroup("Statusline", { clear = true }), mirroring the pattern already used inorgview.lua,scopeline.lua,treesitter.lua, and thetabline_timerfix inoptions.lua.Where
lua/config/statusline.lua:4,:106,:217(pre-change line numbers).Why it matters
None of these three autocmds were registered under an augroup. This repo's own dev notes (
init.luacomments, and thetabline_timerhandling inoptions.lua) treat:source %on individual config files as a normal iterative-dev workflow, and other modules already guard against the fallout withclear = trueaugroups.Without a group, re-sourcing
statusline.luastacks a secondLspProgressautocmd. That new closure owns its ownlsp_progresstable and its ownvim.uv.new_timer()(line 84), but the globalStatusLine()/current_lsp_progress()functions get overwritten by the re-source, so nothing ever reads the old closure's table again — its timer is orphaned exactly like the previously-fixedtabline_timerleak, and keeps firingredrawstatusevery 100ms for as long as the stale closure keeps seeing LSP progress events.Fix
Create one
augrouplocal and passgroup = augroupto all threenvim_create_autocmdcalls. No behavior change on a fresh (non-resourced) start; only affects the re-source workflow.Generated by Claude Code