-
-
Notifications
You must be signed in to change notification settings - Fork 51
Fix: Add viewer hooks and autocmds to hover popup for consistent highlighting #537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Add viewer hooks and autocmds to hover popup for consistent highlighting #537
Conversation
…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.
WalkthroughInserted two viewer events— Changes
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
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. Comment |
There was a problem hiding this 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
Problem:
Currently, the hover popup only calls
helper.fern.renderer.highlight()andhelper.fern.renderer.syntax(), which means user customizations made throughFernHighlight/FernSyntaxautocmds orviewer:highlight/viewer:syntaxhooks 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:syntaxhooks andFernHighlight,FernSyntaxautocmds to the hover popup'ss:apply()function to ensure consistent highlighting between the main fern window and hover popups.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.