Closed Milly closed 2 months ago
The update enhances the Denops plugin by refining server connection logic, adding error handling and reconnection capabilities, and improving test utilities for server behavior. A new connect_or_start
function initiates server connections, while failure callbacks manage reconnections. These changes ensure robust server management, streamlined initialization, and improved test coverage.
File or Directory | Summary |
---|---|
autoload/denops/_internal/server/chan.vim |
Improved connection logic, error handling, and reconnection management by adding new functions and parameters. |
autoload/denops/_internal/server/proc.vim |
Refined process handling with debug outputs, restart delayer, and clear restart logic. |
autoload/denops/server.vim |
Added connect_or_start function to manage server connection and refactored status function. |
denops/@denops-private/testutil/host.ts |
Introduced mode property and updated function calls to pass this property. |
denops/@denops-private/testutil/shared_server.ts |
Added port parameter for server initialization and refactored address handling. |
denops/@denops-private/testutil/shared_server_test.ts |
Enhanced tests to assert addr , host , port , and toString() values for server address. |
doc/denops.txt |
Updated descriptions of server-related variables for clearer understanding of restart and reconnect behavior. |
plugin/denops.vim |
Refactored initialization logic to use connect_or_start function during Vim startup. |
tests/denops/server_test.ts |
Expanded tests for server shutdown, status handling, process events, and reconnect scenarios with improved coverage. |
sequenceDiagram
participant Vim as Vim
participant Denops as Denops Plugin
participant Server as Server
Note over Vim: Server Initialization on Vim Start
Vim->>Denops: Call connect_or_start()
Denops->>Server: Attempt to Connect
alt Connection Success
Server-->>Denops: Successful Connection
Denops-->>Vim: Server Ready
else Connection Failure
Server-->>Denops: Connection Failed
Denops->>Server: Schedule Reconnect
end
Note over Denops: Reconnect Logic on Failure
Denops->>Server: Reconnect Attempt
Server-->>Denops: Connection Status
Note over Tests: Test Scenarios
Tests->>Vim: Simulate Server Events
Vim->>Denops: Handle Events (Ready, Closed, etc.)
Denops-->>Tests: Verify Correct Behavior
🐇 In the lands of code, where servers connect, Debugs and retries, no bug can deflect. With callbacks and guards, reconnections start, Denops now sings a more resilient part. Through tests and tweaks, our journey thus, A server strong, built robust by us! 🌐💻✨
[!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 currently opted into early access features by default.
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 72.72727%
with 3 lines
in your changes missing coverage. Please review.
Project coverage is 92.25%. Comparing base (
97ed0ff
) to head (c36cc9c
).
Files | Patch % | Lines |
---|---|---|
denops/@denops-private/testutil/host.ts | 33.33% | 2 Missing :warning: |
denops/@denops-private/testutil/shared_server.ts | 87.50% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@coderabbitai review
Problem
The behavior of restart and reconnection is inconsistent with the documentation. There are
g:denops#server#retry_*
,g:denops#server#restart_*
andg:denops#server#reconnect_*
variables which can be confusing.g:denops#server#retry_*
variables have never been documented.g:denops#server#restart_threshold=3
is set:g:denops#server#reconnect_threshold=3
is set:retry_threshold
times, i.e. at most(reconnect_threshold - 1) * retry_threshold
times.g:denops#server#reconnect_delay
.Fixes
g:denops#server#retry_*
variables have been completely removed.denops#server#start()
on #378.denops#server#connect()
on This PR.g:denops#server#restart_*
variables are used on first starting or restart.g:denops#disable=1
is set.g:denops#disable=1
is set.g:denops#server#reconnect_*
variables are used on first connecting or reconnect.g:denops#disable=1
.g:denops#disable=1
is set.denops#server#connect()
will asynchronously retry the initial connection. Do not block Vim startup.Summary by CodeRabbit
New Features
denops#server#connect_or_start()
to handle server connections and startups.mode
property toHostFn
andTestFn
types for better configuration in test utilities.useSharedServer
function to supportport
configuration.forceShutdownServer()
for robust server handling in tests.Improvements
denops.vim
plugin.Bug Fixes