Closed Milly closed 2 months ago
[!IMPORTANT]
Review skipped
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yaml
file in this repository. To trigger a single review, invoke the@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
This update enhances the Denops plugin by introducing robust error handling, improved channel management, and streamlined server behaviors. Key changes include adding error callbacks, refining connection retries, enhancing server start and stop mechanisms, and expanding test utilities. These modifications aim for better reliability, consistency in server operations, and improved test coverage.
Files | Change Summary |
---|---|
autoload/denops/_internal/job.vim |
Added error handling for job execution, adjusted callbacks to receive job objects. |
autoload/denops/_internal/server/chan.vim |
Replaced for loop with while for retries, added timeout for channel close, new force close functions. |
autoload/denops/_internal/server/proc.vim |
Simplified server startup, removed retry logic, updated autocmd event names. |
autoload/denops/server.vim |
Added new status constants and functions for server management, introduced new variables for server state management. |
denops/@denops-private/host.ts |
Added close() method to Service interface, updated invoke() function. |
denops/.../host/nvim_test.ts |
Updated function parameters to object destructuring, added close method to Service . |
denops/.../host/vim_test.ts |
Similar updates as nvim_test.ts , added close method to service . |
denops/.../host_test.ts |
Introduced close method in the service object, added corresponding test cases. |
denops/.../testutil/host.ts |
Added stdout and stderr parameters to HostFn and TestFn , updated related functions. |
denops/.../testutil/shared_server.ts |
Modified to handle stderr , added new channels for stdout and stderr . |
denops/.../shared_server_test.ts |
Added new assertions and conditions for verbose output handling, new tests for verbose scenarios. |
denops/.../shared_server_test_no_verbose.ts |
Introduced new file with test scenarios involving a brief delay. |
denops/.../shared_server_test_verbose_true.ts |
Introduced new file with test scenarios for verbose flag set to true . |
denops/.../with.ts |
Enhanced stream and process communication, updated command execution, improved error handling and cleanup. |
denops/.../worker.ts |
Updated command in connectHost to trigger DenopsSystemReady autocmd event. |
denops/.../worker_test.ts |
Updated doautocmd function parameter to DenopsSystemReady in multiple instances. |
doc/denops.txt |
Updated descriptions for restart thresholds, reconnect intervals, close timeout settings, and server functions. |
tests/.../plugin_test.ts |
Updated function definitions for object destructuring of the host parameter. |
tests/.../server_test.ts |
Improved test logic, asynchronous handling, error messages, and status transitions for server operations. |
sequenceDiagram
participant User
participant DenopsPlugin
participant Job
participant ServerChan
participant ServerProc
participant TestUtil
User->>DenopsPlugin: Initialize
DenopsPlugin->>ServerProc: Start server
ServerProc->>ServerChan: Establish connection
ServerChan->>DenopsPlugin: Connection established
User->>DenopsPlugin: Run Command
DenopsPlugin->>Job: Execute job
Job->>DenopsPlugin: Job result
User->>DenopsPlugin: Stop server
DenopsPlugin->>ServerProc: Shutdown server
ServerProc->>ServerChan: Close channels
ServerChan->>TestUtil: Cleanup
Amidst the code in Vim's delightful land,
Denops evolves with error handling grand.
Channels close with grace, no time to wait,
Jobs will run, never check too late.
Servers start and stop, reconnect anew,
In tests we trust, the bugs we now subdue.
Celebrate with hops, our journey never ends,
For each line of code, a rabbit-send depends.
(\(\
( -.-)
o_(")(") đ
[!TIP]
Early access features: disabled
We are currently testing the following features in early access: - **OpenAI `gpt-4o` model for code reviews and chat**: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available. Note: - You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file. - Please join our [Discord Community](https://discord.com/invite/GsXnASn26c) to provide feedback and report issues.
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?
Attention: Patch coverage is 87.34177%
with 10 lines
in your changes missing coverage. Please review.
Project coverage is 92.30%. Comparing base (
dd6ca3c
) to head (f766e94
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I committed đ remove retry_interval, retry_threshold from proc#start() to make it easier to see the diff, and after review I want to amend it to đ change denops#server#start and ...#stop to asynchronous because it breaks tests.
@coderabbitai review
[!NOTE] Currently processing new changes in this PR. This may take a few minutes, please wait...
Commits
Files that changed from the base of the PR and between dd6ca3c4f851f279aac9efd51199f49d7088934b and 5e7e3c26eb8b2d05dae9850811f401da5396d63f.Files selected for processing (19)
* autoload/denops/_internal/job.vim (3 hunks) * autoload/denops/_internal/server/chan.vim (4 hunks) * autoload/denops/_internal/server/proc.vim (6 hunks) * autoload/denops/server.vim (4 hunks) * denops/@denops-private/host.ts (3 hunks) * denops/@denops-private/host/nvim_test.ts (1 hunks) * denops/@denops-private/host/vim_test.ts (1 hunks) * denops/@denops-private/host_test.ts (2 hunks) * denops/@denops-private/testutil/host.ts (3 hunks) * denops/@denops-private/testutil/shared_server.ts (3 hunks) * denops/@denops-private/testutil/shared_server_test.ts (1 hunks) * denops/@denops-private/testutil/shared_server_test_no_verbose.ts (1 hunks) * denops/@denops-private/testutil/shared_server_test_verbose_true.ts (1 hunks) * denops/@denops-private/testutil/with.ts (4 hunks) * denops/@denops-private/worker.ts (1 hunks) * denops/@denops-private/worker_test.ts (7 hunks) * doc/denops.txt (5 hunks) * tests/denops/plugin_test.ts (3 hunks) * tests/denops/server_test.ts (4 hunks)___________________________ < Debugging like it's 2099. > --------------------------- \ \ \ \ /\ ( ) .( o ).
[!TIP]
Early access features: enabled
We are currently testing the following features in early access: - **OpenAI `gpt-4o` model for code reviews and chat**: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available. Note: - You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file. - Please join our [Discord Community](https://discord.com/invite/GsXnASn26c) to provide feedback and report issues. - OSS projects are always opted into early access features.
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?
@Milly ~It seems the status is still draft. Let me know when the PR become ready (I already reviewed in case)~
and after review I want to amend it to đ change denops#server#start and ...#stop to asynchronous because it breaks tests.
Got it. Let me know when rebased @Milly
I rebased it. @lambdalisue
denops-variable
:g:denops#server#close_timeout
denops#server#status()
:closing
closed
denops-function
:denops#server#start()
can now be called even when status isclosing
. In that case, the status will becomestopped
and then restart asynchronously.denops#server#start()
is changed to asynchronously.closing
. In that case, the status will becomestopped
and then restart asynchronously.retry_threshold
), it retries asynchronously (usesrestart_threshold
).denops#server#stop()
is changed to asynchronously.denops#server#restart()
is changed to asynchronously.Summary by CodeRabbit
New Features
close()
method to theService
interface for better resource management.stdout
andstderr
.Bug Fixes
Refactor
for
loops withwhile
loops for better connection retries.Documentation
Tests