Skip to content

Conversation

@sirasagi62
Copy link
Contributor

@sirasagi62 sirasagi62 commented Nov 23, 2025

Problem:

Currently, the hover popup only calls helper.fern.renderer.highlight() and helper.fern.renderer.syntax(), which means user customizations made through FernHighlight/FernSyntax autocmds or viewer:highlight/viewer:syntax hooks are not applied to the hover popups.

As a result, fern-specific customizations made in these hooks/autocmds only affect the main window, creating visual inconsistency. This behavior makes it difficult to customize highlighting that is not defined by Fern, such as CursorLine, which is limited to fern.

See also: #283

Solution:

This PR adds viewer:highlight, viewer:syntax hooks and FernHighlight, FernSyntax autocmds to the hover popup's s:apply() function to ensure consistent highlighting between the main fern window and hover popups.

Summary by CodeRabbit

  • New Features
    • Added two viewer events (FernSyntax and FernHighlight) during hover popup rendering. These events trigger User autocommands so users can hook into and customize syntax and highlight behavior for hover popups.

✏️ Tip: You can customize this high-level summary in your review settings.

…lighting

Problem:

Currently, the hover popup only calls `helper.fern.renderer.highlight()`
and `helper.fern.renderer.syntax()`, which means user customizations
made through `FernHighlight`/`FernSyntax` autocmds or
`viewer:highlight`/`viewer:syntax` hooks are not applied to the hover
popups.

As a result, fern-specific customizations made in these hooks/autocmds
only affect the main window, creating visual inconsistency. This
behavior makes it difficult to customize highlighting that is not
defined by Fern, such as CursorLine, which is limited to fern.

See also: lambdalisue#283

Solution:

This PR adds `viewer:highlight`, `viewer:syntax` hooks and
`FernHighlight`, `FernSyntax` autocmds to the hover popup's `s:apply()`
function to ensure consistent highlighting between the main fern window
and hover popups.
@coderabbitai
Copy link

coderabbitai bot commented Nov 23, 2025

Walkthrough

Inserted two viewer events—viewer:syntax and viewer:highlight—emitted inside s:apply() of the hover popup drawer immediately after calling helper.fern.renderer.syntax() and helper.fern.renderer.highlight(), each triggering corresponding User autocommands.

Changes

Cohort / File(s) Change Summary
Hover popup drawer — event emissions
autoload/fern/internal/drawer/hover_popup.vim
After helper.fern.renderer.syntax() emit viewer:syntax and trigger User FernSyntax; after helper.fern.renderer.highlight() emit viewer:highlight and trigger User FernHighlight. Events are added into the s:apply() render flow immediately following the respective renderer calls.

Sequence Diagram(s)

sequenceDiagram
  participant Drawer as HoverPopup s:apply()
  participant Helper as helper
  participant Renderer as helper.fern.renderer
  participant Events as Vim events (User)
  Drawer->>Renderer: helper.fern.renderer.syntax()
  Renderer-->>Drawer: syntax rendered
  Drawer->>Events: emit viewer:syntax
  Events-->>Events: User FernSyntax autocommand

  Drawer->>Renderer: helper.fern.renderer.highlight()
  Renderer-->>Drawer: highlight applied
  Drawer->>Events: emit viewer:highlight
  Events-->>Events: User FernHighlight autocommand
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Check that event names (viewer:syntax, viewer:highlight) and autocommand names (FernSyntax, FernHighlight) match project conventions.
  • Confirm the emissions occur at the intended points (immediately after the renderer calls) and do not break assumptions about render ordering.
  • Verify no unintended side effects or duplicate triggers in surrounding logic.

Poem

🐰 I nudged a whisper into the flow,

viewer:syntax then viewer:highlight aglow,
Hooks hop in, a tiny parade,
Rendered fields bright in the shade,
A rabbit cheers for events now made.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding viewer hooks and autocommands to hover popups to fix inconsistent highlighting, which directly aligns with the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecebdb4 and 0118386.

📒 Files selected for processing (1)
  • autoload/fern/internal/drawer/hover_popup.vim (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • autoload/fern/internal/drawer/hover_popup.vim
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test (macos-latest, v8.2.5136)

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

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb60188 and ecebdb4.

📒 Files selected for processing (1)
  • autoload/fern/internal/drawer/hover_popup.vim (1 hunks)

@lambdalisue lambdalisue merged commit d0b5bef into lambdalisue:main Nov 23, 2025
13 checks passed
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.

2 participants