Skip to content

feat: add support for lualine & fidget#3

Merged
smnatale merged 2 commits into
mainfrom
feat/fidget-lualine-support
Apr 13, 2026
Merged

feat: add support for lualine & fidget#3
smnatale merged 2 commits into
mainfrom
feat/fidget-lualine-support

Conversation

@smnatale
Copy link
Copy Markdown
Owner

@smnatale smnatale commented Apr 13, 2026

Description

Add support for fidget.nvim display & lualine progress

Screenshots/Images

fidget.nvim
image
lualine.nvim
image

Summary by CodeRabbit

Release Notes

  • New Features

    • Added status reporting for active review operations
    • Introduced animated progress feedback with optional progress indicator support
    • Enhanced notifications with throttled updates to reduce message frequency
  • Chores

    • Updated default CLI timeout configuration value

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

📝 Walkthrough

Walkthrough

The pull request introduces status tracking functionality to the CodeRabbit module by adding a new M.status() function that returns a statusline string with spinner animation and elapsed time. It integrates optional fidget.progress notifications, replacing unconditional vim.notify calls with throttled updates. Additionally, the default CLI timeout configuration is changed from 120000 to 0 milliseconds.

Changes

Cohort / File(s) Summary
Configuration timeout adjustment
lua/coderabbit/config.lua
Default CLI timeout changed from 120000 to 0 in M.defaults.cli.timeout.
Status tracking and UI enhancements
lua/coderabbit/init.lua, lua/coderabbit/review.lua
New M.status() function exported from both modules, delegating from init.lua to review.lua. review.lua implements status reporting with spinner animation and fidget.progress integration, replaces unconditional notifications with optional fidget updates and throttled fallback notifications, adds lifecycle management for start time and fidget handle initialisation/finalisation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~35 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add support for lualine & fidget' directly and clearly summarizes the main changes: adding support for two UI integration libraries (lualine and fidget.nvim), which aligns with the substantial modifications across config.lua, init.lua, and review.lua.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lua/coderabbit/review.lua (1)

133-166: ⚠️ Potential issue | 🔴 Critical

Do not clear the active job before the cancelled process has actually exited.

M.stop() sets state.job_id = nil immediately, but cli.cancel() is asynchronous. That means a second review can start before the first job's on_exit runs, and when that old callback finally arrives it will wipe the new run's state and may emit the wrong completion/error notifications or call on_review_complete for the cancelled run.

Suggested fix
 local state = {
   job_id = nil,
   findings = {},
   cwd = nil,
   start_time = nil,
   fidget_handle = nil,
   last_notify_time = nil,
+  cancelling = false,
 }

 function M.run(opts)
   opts = opts or {}
@@
   state.findings = {}
   state.cwd = vim.fn.getcwd()
+  state.cancelling = false
   local cfg = config.get()
@@
     on_exit = function(code, stderr)
+      local was_cancelling = state.cancelling
       state.job_id = nil
       state.start_time = nil
       state.last_notify_time = nil
+      state.cancelling = false
+
+      if was_cancelling then
+        return
+      end

       if code == -1 then
         fidget_finish("timed out")
         vim.notify("CodeRabbit: Review timed out", vim.log.levels.ERROR)
         return
@@
 function M.stop()
   if state.job_id then
+    state.cancelling = true
     fidget_finish("cancelled")
     cli.cancel(state.job_id)
-    state.job_id = nil
     vim.notify("CodeRabbit: Review cancelled", vim.log.levels.INFO)
   else
     vim.notify("CodeRabbit: No review in progress", vim.log.levels.WARN)
   end
 end

Also applies to: 171-176

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lua/coderabbit/review.lua` around lines 133 - 166, The current code clears
state.job_id, state.start_time and state.last_notify_time immediately in
M.stop() while cli.cancel() is async, which lets a new review start and then
have the old on_exit wipe the new state; instead, stop clearing state in
M.stop() and move/keep the clearing logic inside the on_exit callback (the
function named on_exit) so it only clears if the exiting job matches the current
state.job_id (e.g., compare a captured job_id or use a passed job identifier to
ensure on_exit only resets state when state.job_id == exiting_job_id); apply the
same change to the other similar cancellation block that clears state
immediately (the block referenced around lines 171-176).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lua/coderabbit/config.lua`:
- Line 6: The default timeout was set to 0 which disables the timeout path in
lua/coderabbit/cli.lua and can hang the `cr` process; change the default
`timeout` value in lua/coderabbit/config.lua from 0 to a finite sensible default
(e.g., 30 seconds) and ensure the CLI logic in lua/coderabbit/cli.lua continues
to read the `timeout` config (not treating 0 as the only timeout case). Update
the `timeout` variable in config.lua and verify any code paths that check
`timeout` (the timeout handling in cli.lua) treat positive values as the timeout
to enforce.

---

Outside diff comments:
In `@lua/coderabbit/review.lua`:
- Around line 133-166: The current code clears state.job_id, state.start_time
and state.last_notify_time immediately in M.stop() while cli.cancel() is async,
which lets a new review start and then have the old on_exit wipe the new state;
instead, stop clearing state in M.stop() and move/keep the clearing logic inside
the on_exit callback (the function named on_exit) so it only clears if the
exiting job matches the current state.job_id (e.g., compare a captured job_id or
use a passed job identifier to ensure on_exit only resets state when
state.job_id == exiting_job_id); apply the same change to the other similar
cancellation block that clears state immediately (the block referenced around
lines 171-176).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 938a8215-2568-40f3-b2f9-28ed7a92d2f8

📥 Commits

Reviewing files that changed from the base of the PR and between 4c5d4f7 and 6a679dc.

📒 Files selected for processing (3)
  • lua/coderabbit/config.lua
  • lua/coderabbit/init.lua
  • lua/coderabbit/review.lua

Comment thread lua/coderabbit/config.lua
@smnatale smnatale merged commit ea2fedf into main Apr 13, 2026
4 checks passed
@smnatale smnatale deleted the feat/fidget-lualine-support branch April 13, 2026 11:15
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