Skip to content

fix(tracker): flush active file before switching - #4

Closed
taigrr wants to merge 1 commit into
masterfrom
cd/fix-file-switch-flush
Closed

taigrr wants to merge 1 commit into
masterfrom
cd/fix-file-switch-flush

Conversation

@taigrr

@taigrr taigrr commented May 9, 2026

Copy link
Copy Markdown
Owner

Summary\n- flush the current file immediately before switching buffers\n- preserve active seconds and pending metrics on file changes\n- keep the tracker on the new file after the flush completes\n\n## Testing\n- stylua --check .\n- luacheck .

@taigrr

taigrr commented May 11, 2026

Copy link
Copy Markdown
Owner Author

Thanks for the contribution! However, I'm closing this because removing vim.schedule() would make the flush synchronous, and socket.send() can block Neovim's main thread for up to 1.5 seconds (via vim.wait() in connect() and ensure_blastd()). This would cause noticeable lag when switching buffers.

The current vim.schedule() wrapper is intentional — it ensures buffer switches feel instant while the socket work happens on the next event loop tick.

@taigrr taigrr closed this May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant