-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
👍 Forcibly show info/warn/error messages block to the user (RFC) #377
Conversation
Users may not realize that there are info/warn/error messages in the message history. This commit forcibly shows the messages to the user when the messages are posted with `console.info/warn/error` functions in Denops side.
WalkthroughThe recent changes introduce a new mechanism for handling delayed messages in the file Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Vim
participant EchoMsg as s:echomsg
participant EchoMsgDelay as s:echomsg_delay
participant EchoMsgBatch as s:echomsg_batch
User->>Vim: Input command triggering message
Vim->>EchoMsg: Call s:echomsg(hl, msg)
EchoMsg->>EchoMsgDelay: Check if delay is needed
alt Delayed message
EchoMsgDelay-->>EchoMsgBatch: Store message for batch processing
else Immediate message
EchoMsg->>Vim: Display message
end
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #377 +/- ##
=======================================
Coverage 90.20% 90.20%
=======================================
Files 9 9
Lines 684 684
Branches 67 67
=======================================
Hits 617 617
Misses 67 67 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Milly <[email protected]>
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- autoload/denops/_internal/echo.vim (3 hunks)
Additional comments not posted (4)
autoload/denops/_internal/echo.vim (4)
1-1
: Initialization of delay mechanism variablesThe constants and variables for handling delayed messages (
s:DELAYED_INTERVAL
,s:delayed_messages
, ands:delayed_timer
) are correctly initialized. However, consider adding comments to describe their purpose for better maintainability.Also applies to: 3-4
25-25
: Use ofs:echomsg_delay
in message functionsThe usage of
s:echomsg_delay
indenops#_internal#echo#info
,denops#_internal#echo#warn
, anddenops#_internal#echo#error
is consistent and aligns with the PR's goal to ensure messages are not overlooked. This change effectively queues messages for delayed display.Also applies to: 29-29, 33-33
44-48
: Implementation ofs:echomsg_delay
The function
s:echomsg_delay
correctly queues messages for delayed display and manages the timer to triggers:echomsg_batch
. However, stopping the timer before potentially restarting it ensures that no messages are lost if the function is called repeatedly in quick succession.
50-60
: Batch processing and forced display of messagesThe
s:echomsg_batch
function processes queued messages and usesfeedkeys
to forcibly display them. This approach is effective but could potentially interrupt user input. Consider the feedback from the previous comments regarding the use of<Cmd>...<CR>
to avoid breaking user input in command-mode.- call feedkeys(printf("\<Cmd>%dmessages\<CR>", l:counter), 'n') + call feedkeys(printf("\<Cmd>messages\<CR>", l:counter), 'n')
Users may not realize that there are info/warn/error messages in the message history. This commit forcibly shows the messages to the user when the messages are posted with
console.info/warn/error
functions in Denops side.With this change, for example Denops plugin loading issue is shown on the Vim start-up like below (tested with https://github.com/vim-denops/denops-issue358.vim)
CleanShot.2024-06-25.at.01.53.49.mp4
Summary by CodeRabbit