Skip to content
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

🎉 Denops v7 #344

Merged
merged 99 commits into from
Jul 27, 2024
Merged

🎉 Denops v7 #344

merged 99 commits into from
Jul 27, 2024

Conversation

lambdalisue
Copy link
Member

@lambdalisue lambdalisue commented May 12, 2024

  • Deno: 1.38.x -> 1.43.x 1.45.x
  • Vim: 9.0.2189 -> 9.1.0399 9.1.0448
  • Neovim: 0.9.4 -> 0.9.5 0.10.0

Ref

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced asynchronous request interruption with denops#interrupt(...).
    • Added plugin unload functionality with improved error handling.
    • Implemented new wait function for polling asynchronous operations.
    • Added support for shared server management in testing environments.
    • Introduced dummy plugins for testing purposes.
  • Enhancements

    • Updated version support for Deno, Vim, and Neovim across documentation and plugin management.
    • Improved error handling for job executions.
    • Enhanced job handling logic for Vim and Neovim RPC modules.
    • Refined connection management and reconnect logic for the server.
    • Introduced mock utility functions for testing purposes.
  • Tests

    • Introduced new test cases for various Denops plugins and scenarios.
    • Enhanced the testing framework with new assertions and improved coverage for the Service class.
  • Documentation

    • Updated Denops usage settings and variable descriptions in documentation, including a new recommended section.

@lambdalisue lambdalisue marked this pull request as draft May 12, 2024 12:19
Copy link

coderabbitai bot commented May 12, 2024

Walkthrough

The recent updates to the Denops project enhance functionality and improve version compatibility. Key changes include new features for plugin management, error handling, and asynchronous operations. GitHub workflows have been refined, and documentation has been updated accordingly. These improvements aim to provide a robust development environment for Vim and Neovim plugins, ensuring better stability and an improved user experience.

Changes

Files/Directories Change Summary
.github/workflows/test.yml, .github/workflows/update.yml Updated workflow configurations, including job dependencies, version updates, and command adjustments.
README.md Updated version badges for Deno, Vim, and Neovim; removed Deno Land badge.
autoload/denops.vim Added denops#interrupt(...) function for managing asynchronous interruptions.
autoload/denops/_internal/job.vim, autoload/denops/_internal/plugin.vim Improved error handling and introduced new functions for plugin management.
denops/@denops-private/service.ts, denops/@denops-private/version.ts Updated Service class with lifecycle management and error handling; modified version imports.
tests/denops/testutil/... Added mock utilities and configurations for testing, improving the robustness of the test suite.
tests/denops/testutil/shared_server.ts, tests/denops/testutil/shared_server_test.ts Introduced functionality for managing a shared server in tests and associated test cases.
denops/@denops-private/service_test.ts Enhanced test suite for the Service class, improving coverage and error handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Plugin
    participant Denops
    participant Host

    User ->> Plugin: Load new plugin
    Plugin ->> Denops: Register plugin
    Denops ->> Host: Initialize plugin environment
    Host ->> Denops: Confirmation
    Denops ->> Plugin: Initialization complete

    User ->> Plugin: Execute command
    Plugin ->> Denops: Process command
    Denops ->> Host: Execute command
    Host -->> Denops: Return result
    Denops ->> Plugin: Provide result
    Plugin ->> User: Display result

    User ->> Plugin: Unload plugin
    Plugin ->> Denops: Unregister plugin
    Denops ->> Host: Cleanup plugin environment
    Host ->> Denops: Confirmation
    Denops ->> Plugin: Unload complete
Loading

Poem

Amidst the code, a change took place,
With vim and vigor, we embrace,
New versions rise, old bugs subside,
Denops now, a smoother ride.
Functions added, features grow,
Interruptions handled, let’s go!
Celebrate the update cheer,
A brighter path, now crystal clear.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented May 12, 2024

Codecov Report

Attention: Patch coverage is 96.32768% with 26 lines in your changes missing coverage. Please review.

Project coverage is 95.44%. Comparing base (09e6495) to head (6eb990e).

Files Patch % Lines
tests/denops/testutil/host.ts 86.00% 7 Missing ⚠️
tests/denops/testutil/with.ts 94.30% 7 Missing ⚠️
tests/denops/testutil/shared_server.ts 94.04% 5 Missing ⚠️
denops/@denops-private/worker.ts 93.87% 2 Missing and 1 partial ⚠️
denops/@denops-private/cli.ts 96.15% 2 Missing ⚠️
tests/denops/testutil/conf.ts 83.33% 0 Missing and 1 partial ⚠️
tests/denops/testutil/wait.ts 97.91% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #344      +/-   ##
==========================================
+ Coverage   90.20%   95.44%   +5.23%     
==========================================
  Files           9       23      +14     
  Lines         684     1361     +677     
  Branches       67      174     +107     
==========================================
+ Hits          617     1299     +682     
+ Misses         67       59       -8     
- Partials        0        3       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

lambdalisue added a commit to vim-denops/deno-denops-test that referenced this pull request May 12, 2024
lambdalisue added a commit to vim-denops/deno-denops-test that referenced this pull request May 12, 2024
@lambdalisue lambdalisue added this to the v7.0 milestone May 12, 2024
lambdalisue added a commit to vim-denops/deno-denops-std that referenced this pull request May 14, 2024
deno.jsonc Outdated Show resolved Hide resolved
@lambdalisue
Copy link
Member Author

lambdalisue commented Jun 18, 2024

denoland/deno#23792
https://uki00a.github.io/deno-weekly/articles/2024/06/16.html#node-api

Node API is fixed so we can remove fc956a9 if we use Deno 1.44.2 or later

P.S.

I removed the workaround commit and rebased.

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

Commits

Files that changed from the base of the PR and between 09e6495 and 40f21c7.

Files selected for processing (57)
  • .github/workflows/test.yml (1 hunks)
  • .github/workflows/update.yml (1 hunks)
  • README.md (1 hunks)
  • autoload/denops.vim (1 hunks)
  • autoload/denops/_internal/job.vim (2 hunks)
  • autoload/denops/_internal/plugin.vim (3 hunks)
  • autoload/denops/_internal/rpc/nvim.vim (1 hunks)
  • autoload/denops/_internal/rpc/vim.vim (1 hunks)
  • autoload/denops/_internal/server/chan.vim (3 hunks)
  • autoload/denops/_internal/server/proc.vim (6 hunks)
  • autoload/denops/_internal/test.vim (1 hunks)
  • autoload/denops/plugin.vim (2 hunks)
  • autoload/denops/server.vim (6 hunks)
  • autoload/health/denops.vim (1 hunks)
  • deno.jsonc (1 hunks)
  • denops/@denops-private/cli.ts (4 hunks)
  • denops/@denops-private/cli_test.ts (1 hunks)
  • denops/@denops-private/denops.ts (2 hunks)
  • denops/@denops-private/denops_test.ts (2 hunks)
  • denops/@denops-private/error.ts (1 hunks)
  • denops/@denops-private/error_test.ts (1 hunks)
  • denops/@denops-private/host.ts (4 hunks)
  • denops/@denops-private/host/nvim.ts (2 hunks)
  • denops/@denops-private/host/nvim_test.ts (4 hunks)
  • denops/@denops-private/host/vim.ts (2 hunks)
  • denops/@denops-private/host/vim_test.ts (4 hunks)
  • denops/@denops-private/host_test.ts (1 hunks)
  • denops/@denops-private/mod.ts (1 hunks)
  • denops/@denops-private/plugin.ts (1 hunks)
  • denops/@denops-private/service.ts (6 hunks)
  • denops/@denops-private/service_test.ts (2 hunks)
  • denops/@denops-private/util.ts (1 hunks)
  • denops/@denops-private/version.ts (1 hunks)
  • denops/@denops-private/worker.ts (2 hunks)
  • denops/@denops-private/worker_test.ts (1 hunks)
  • doc/denops.txt (9 hunks)
  • plugin/denops.vim (2 hunks)
  • plugin/denops/debug.vim (1 hunks)
  • tests/denops/runtime/functions/plugin_test.ts (1 hunks)
  • tests/denops/runtime/functions/server_test.ts (1 hunks)
  • tests/denops/runtime/plugin_test.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_constraint_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_constraint_plugin2.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_dispose_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/@dummy_namespace/main.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/dummy_invalid/main.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/dummy_valid/main.ts (1 hunks)
  • tests/denops/testdata/dummy_valid_dispose_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_valid_plugin.ts (1 hunks)
  • tests/denops/testdata/shared_server_test_no_verbose.ts (1 hunks)
  • tests/denops/testdata/shared_server_test_verbose_true.ts (1 hunks)
  • tests/denops/testutil/conf.ts (3 hunks)
  • tests/denops/testutil/conf_test.ts (1 hunks)
  • tests/denops/testutil/host.ts (1 hunks)
  • tests/denops/testutil/mock.ts (1 hunks)
  • tests/denops/testutil/mock_test.ts (1 hunks)
Files not processed due to max files limit (5)
  • tests/denops/testutil/shared_server.ts
  • tests/denops/testutil/shared_server_test.ts
  • tests/denops/testutil/wait.ts
  • tests/denops/testutil/wait_test.ts
  • tests/denops/testutil/with.ts
Files not summarized due to errors (2)
  • denops/@denops-private/service_test.ts: Error: Message exceeds token limit
  • tests/denops/runtime/functions/server_test.ts: Error: Message exceeds token limit
Files skipped from review due to trivial changes (10)
  • .github/workflows/update.yml
  • denops/@denops-private/error_test.ts
  • denops/@denops-private/mod.ts
  • denops/@denops-private/util.ts
  • tests/denops/testdata/dummy_invalid_constraint_plugin.ts
  • tests/denops/testdata/dummy_invalid_constraint_plugin2.ts
  • tests/denops/testdata/dummy_invalid_plugin.ts
  • tests/denops/testdata/dummy_plugins/denops/@dummy_namespace/main.ts
  • tests/denops/testdata/dummy_valid_plugin.ts
  • tests/denops/testutil/conf_test.ts
Additional context used
Learnings (4)
autoload/denops/plugin.vim (1)
Learnt from: Milly
PR: vim-denops/denops.vim#385
File: autoload/denops/plugin.vim:56-58
Timestamp: 2024-07-05T15:37:46.867Z
Learning: In the Denops.vim project, the `denops#plugin#unload()` function is designed to throw exceptions to the caller, who is responsible for handling them.
autoload/denops/_internal/plugin.vim (1)
Learnt from: Milly
PR: vim-denops/denops.vim#385
File: autoload/denops/plugin.vim:56-58
Timestamp: 2024-07-05T15:37:46.867Z
Learning: In the Denops.vim project, the `denops#plugin#unload()` function is designed to throw exceptions to the caller, who is responsible for handling them.
denops/@denops-private/host/vim_test.ts (1)
Learnt from: Milly
PR: vim-denops/denops.vim#352
File: denops/@denops-private/testutil/host.ts:3-4
Timestamp: 2024-05-25T06:35:34.785Z
Learning: `Neovim` and `Vim` from `../host/nvim.ts` and `../host/vim.ts` are classes and should be imported normally if they are instantiated in the code.
denops/@denops-private/host/nvim_test.ts (1)
Learnt from: Milly
PR: vim-denops/denops.vim#352
File: denops/@denops-private/testutil/host.ts:3-4
Timestamp: 2024-05-25T06:35:34.785Z
Learning: `Neovim` and `Vim` from `../host/nvim.ts` and `../host/vim.ts` are classes and should be imported normally if they are instantiated in the code.
Biome
denops/@denops-private/plugin.ts

[error] 35-35: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

denops/@denops-private/service.ts

[error] 184-184: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)

GitHub Check: codecov/patch
tests/denops/testutil/host.ts

[warning] 41-41: tests/denops/testutil/host.ts#L41
Added line #L41 was not covered by tests


[warning] 85-86: tests/denops/testutil/host.ts#L85-L86
Added lines #L85 - L86 were not covered by tests

denops/@denops-private/cli.ts

[warning] 105-105: denops/@denops-private/cli.ts#L105
Added line #L105 was not covered by tests

denops/@denops-private/worker.ts

[warning] 113-113: denops/@denops-private/worker.ts#L113
Added line #L113 was not covered by tests

denops/@denops-private/host.ts

[warning] 77-77: denops/@denops-private/host.ts#L77
Added line #L77 was not covered by tests

LanguageTool
doc/denops.txt

[grammar] ~136-~136: Possible subject-verb agreement error detected.
Context: ...iseconds before restarting the server. This avoid #136. https://github.com/vim-denops/den...

(THIS_THAT_AGR)


[uncategorized] ~156-~156: Possible missing article found.
Context: ...oid infinite errors. Denops will reset internal counter when the channel keeps connecti...

(AI_HYDRA_LEO_MISSING_AN)

Additional comments not posted (236)
tests/denops/testdata/dummy_plugins/denops/dummy_invalid/main.ts (2)

3-5: Function definition.

The function main is defined as an Entrypoint and throws an error. This is appropriate for a dummy plugin intended to test error handling.


1-1: Import statement update.

The import statement has been updated to use jsr:@denops/core. Ensure that this change is consistent with the updated import paths across the codebase.

Verification successful

Import statement update verified.

The import path jsr:@denops/core is consistently used across the codebase.

  • tests/denops/testdata/dummy_invalid_constraint_plugin.ts
  • tests/denops/testdata/dummy_valid_plugin.ts
  • tests/denops/testdata/dummy_invalid_constraint_plugin2.ts
  • tests/denops/testdata/dummy_invalid_plugin.ts
  • tests/denops/testdata/dummy_plugins/denops/@dummy_namespace/main.ts
  • tests/denops/testdata/dummy_plugins/denops/dummy_valid/main.ts
  • tests/denops/testdata/dummy_plugins/denops/dummy_invalid/main.ts
  • denops/@denops-private/plugin.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the import path `jsr:@denops/core` is consistent across the codebase.

# Test: Search for the import path. Expect: Only occurances of `jsr:@denops/core`.
rg --type ts $'from "jsr:@denops/core"'

Length of output: 981

tests/denops/testdata/dummy_plugins/denops/dummy_valid/main.ts (2)

1-1: Import statement update.

The import statement has been updated to use jsr:@denops/core. Ensure that this change is consistent with the updated import paths across the codebase.


3-5: Function definition.

The function main is defined as an Entrypoint and executes a command asynchronously. This is appropriate for a dummy plugin intended to test valid command execution.

tests/denops/testdata/shared_server_test_no_verbose.ts (2)

4-7: Usage of shared server.

The code uses a shared server without verbose logging and introduces a delay. This is appropriate for a test scenario.


1-2: Import statements update.

The import statements have been updated to use jsr:@std/async@0.224.0/delay and /denops-testutil/shared_server.ts. Ensure that these changes are consistent with the updated import paths across the codebase.

Verification successful

Import statements update verified.

The import paths jsr:@std/async@0.224.0/delay and /denops-testutil/shared_server.ts are consistently used across the codebase, and no old import paths were found.

  • jsr:@std/async@0.224.0/delay:

    • tests/denops/testdata/shared_server_test_verbose_true.ts
    • tests/denops/testdata/shared_server_test_no_verbose.ts
    • tests/denops/testutil/shared_server_test.ts
    • denops/@denops-private/worker_test.ts
    • denops/@denops-private/cli_test.ts
    • denops/@denops-private/host/vim_test.ts
    • denops/@denops-private/host/nvim_test.ts
  • /denops-testutil/shared_server.ts:

    • tests/denops/testdata/shared_server_test_verbose_true.ts
    • tests/denops/testdata/shared_server_test_no_verbose.ts
    • tests/denops/runtime/plugin_test.ts
    • tests/denops/runtime/functions/server_test.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the import paths `jsr:@std/async@0.224.0/delay` and `/denops-testutil/shared_server.ts` are consistent across the codebase.

# Test: Search for the import paths. Expect: Only occurances of the new paths.
rg --type ts $'from "jsr:@std/async@0.224.0/delay"'
rg --type ts $'from "/denops-testutil/shared_server.ts"'

Length of output: 1268


Script:

#!/bin/bash
# Description: Verify that there are no old import paths for `delay` and `useSharedServer`.

# Test: Search for old import paths. Expect: No occurrences of the old paths.
rg --type ts $'from "https://deno.land/x/std@0.224.0/async/delay.ts"'
rg --type ts $'from "../shared_server.ts"'

Length of output: 114

tests/denops/testdata/shared_server_test_verbose_true.ts (2)

1-2: Import statements update.

The import statements have been updated to use jsr:@std/async@0.224.0/delay and /denops-testutil/shared_server.ts. Ensure that these changes are consistent with the updated import paths across the codebase.


4-7: Usage of shared server with verbose logging.

The code uses a shared server with verbose logging and introduces a delay. This is appropriate for a test scenario.

tests/denops/testdata/dummy_valid_dispose_plugin.ts (1)

1-9: LGTM!

The code introduces a valid entry point with an async dispose method that uses denops.cmd to echo a message. The implementation looks correct.

tests/denops/testdata/dummy_invalid_dispose_plugin.ts (1)

1-9: LGTM!

The code introduces a valid entry point with an async dispose method that throws an error. The implementation looks correct.

denops/@denops-private/error.ts (3)

1-7: LGTM!

The import paths have been updated to use jsr imports. The changes look correct.


Line range hint 9-15:
LGTM!

The errorSerializer function correctly serializes an error object to a JSON string. The implementation looks correct.


Line range hint 17-27:
LGTM!

The errorDeserializer function correctly deserializes a JSON string to an error object. The implementation looks correct.

plugin/denops/debug.vim (1)

12-14: LGTM!

The new autocmd events handle plugin unloading states and look correct.

autoload/denops/_internal/test.vim (2)

11-11: LGTM!

The change to use _handle in the argument dictionary aligns with the modifications in the denops#_internal#rpc#vim#notify function.


15-15: LGTM!

The change to use _handle in the argument dictionary aligns with the modifications in the denops#_internal#rpc#vim#request function.

denops/@denops-private/version.ts (2)

1-4: LGTM!

The imports have been correctly updated to use jsr imports, aligning with the new versioning scheme.


Line range hint 6-21: LGTM!

The function getVersionOr correctly handles the command output and fallback logic.

deno.jsonc (4)

3-8: LGTM!

The task definitions have been correctly updated and new tasks added to align with the intended functionality.


11-14: LGTM!

The test exclusion and the TODO comment are clear and necessary.


16-18: LGTM!

The .coverage/ directory exclusion is necessary and aligns with the intended functionality.


20-22: LGTM!

The import mappings for test modules are correct and align with the intended functionality.

denops/@denops-private/plugin.ts (1)

1-2: LGTM!

The TODO comment is clear, and the import statement is correct.

plugin/denops.vim (3)

6-8: LGTM! Version check updated correctly.

The version check for Vim and Neovim has been updated to the required versions. The warning message is appropriate.


25-27: LGTM! New autocommands added correctly.

The new autocommands for plugin unload events are correctly defined and placed within the appropriate autocommand group.


34-37: LGTM! Server connection logic is appropriate.

The function call to connect or start the server is correctly placed and the logic is appropriate for Vim startup or later.

autoload/denops/_internal/rpc/vim.vim (4)

6-14: LGTM! Channel handling updated correctly.

The changes to handle the channel object and close callback in the denops#_internal#rpc#vim#connect function are correct.


23-25: LGTM! Close callback handled correctly.

The changes to call the close callback after closing the channel in the denops#_internal#rpc#vim#close function are correct.


29-29: LGTM! Channel handle used correctly.

The changes to use the channel handle in the denops#_internal#rpc#vim#notify function are correct.


33-33: LGTM! Channel handle used correctly.

The changes to use the channel handle in the denops#_internal#rpc#vim#request function are correct.

autoload/denops.vim (1)

28-34: LGTM! New interrupt function added correctly.

The new function denops#interrupt for interrupting asynchronous requests is correctly implemented.

tests/denops/testutil/conf.ts (3)

1-3: LGTM! Import statements updated correctly.

The import statements have been updated to use jsr imports correctly.


12-12: LGTM! Config interface updated correctly.

The Config interface has been updated to include an optional timeout property correctly.


22-30: LGTM! getConfig function updated correctly.

The getConfig function has been updated to handle the timeout property correctly.

autoload/denops/_internal/rpc/nvim.vim (1)

27-27: LGTM! The changes are correct and improve asynchronous handling.

The added line ensures the _on_close callback is executed asynchronously after the channel is closed.

denops/@denops-private/denops.ts (3)

6-7: LGTM! The import path changes are correct.

The import paths have been updated to use jsr imports, reflecting the new module locations.


16-19: LGTM! The type changes are correct.

The addition of the interrupted property to the Service type aligns with the new functionality.


43-45: LGTM! The class changes are correct.

The new interrupted property correctly returns the interrupted signal from the service.

.github/workflows/test.yml (2)

51-51: LGTM! The Deno version update is correct.

The Deno version has been updated to 1.44.x, aligning with the PR objectives.


54-56: LGTM! The Vim and Neovim version updates are correct.

The Vim version has been updated to v9.1.0448 and the Neovim version to v0.10.0, aligning with the PR objectives.

tests/denops/testutil/host.ts (3)

1-4: LGTM! The import changes are correct.

The new imports reflect the updated module locations.


19-42: LGTM! The withHost function is well-implemented.

The function correctly handles the different hosts based on the mode parameter.

Tools
GitHub Check: codecov/patch

[warning] 41-41: tests/denops/testutil/host.ts#L41
Added line #L41 was not covered by tests


63-86: LGTM! The testHost function is well-implemented.

The function correctly handles the different testing modes and integrates with Deno's testing framework.

Consider adding tests for uncovered lines.

The static analysis tool indicates that lines 41 and 85-86 are not covered by tests. Ensure these lines are covered to improve test coverage.

Tools
GitHub Check: codecov/patch

[warning] 85-86: tests/denops/testutil/host.ts#L85-L86
Added lines #L85 - L86 were not covered by tests

autoload/denops/_internal/job.vim (5)

27-32: Verify the correctness of the on_exit callback parameters.

Ensure that the status and event parameters passed to on_exit are correct and consistent with the expected values.


65-72: Verify the correctness of the exit_cb callback parameters.

Ensure that the status and event parameters passed to exit_cb are correct and consistent with the expected values.


81-82: Verify the usage of the event parameter in s:out_cb.

Ensure that the event parameter is correctly used within the callback function.


85-86: Verify the usage of the status parameter in s:exit_cb.

Ensure that the status parameter is correctly used within the callback function.


27-32: Verify the correctness of the on_exit callback parameters.

Ensure that the status and event parameters passed to on_exit are correct and consistent with the expected values.

denops/@denops-private/cli.ts (4)

Line range hint 12-31: Verify the robustness of the worker termination logic.

Ensure that the worker termination logic is robust and does not introduce any resource leaks.


Line range hint 37-101: Verify the robustness of the connection handling logic.

Ensure that the connection handling logic is robust and does not introduce any resource leaks.

Tools
GitHub Check: codecov/patch

[warning] 105-105: denops/@denops-private/cli.ts#L105
Added line #L105 was not covered by tests


60-82: Verify the robustness of the error handling logic.

Ensure that the error handling logic is robust and does not introduce any resource leaks.


Line range hint 37-101: Verify the robustness of the connection handling logic.

Ensure that the connection handling logic is robust and does not introduce any resource leaks.

Tools
GitHub Check: codecov/patch

[warning] 105-105: denops/@denops-private/cli.ts#L105
Added line #L105 was not covered by tests

denops/@denops-private/worker.ts (4)

66-91: Verify the robustness of the host detection logic.

Ensure that the host detection logic is robust and does not introduce any resource leaks.


94-110: Verify the robustness of the error handling logic.

Ensure that the error handling logic is robust and does not introduce any resource leaks.


94-110: Verify the robustness of the error handling logic.

Ensure that the error handling logic is robust and does not introduce any resource leaks.


66-91: Verify the robustness of the host detection logic.

Ensure that the host detection logic is robust and does not introduce any resource leaks.

denops/@denops-private/host.ts (4)

27-27: Verify the correctness of the asynchronous behavior in notify.

Ensure that the asynchronous behavior does not introduce any unintended side effects.


69-90: Verify the correctness of the new service methods in invoke.

Ensure that the new service methods are correctly implemented and do not introduce any unintended side effects.

Tools
GitHub Check: codecov/patch

[warning] 77-77: denops/@denops-private/host.ts#L77
Added line #L77 was not covered by tests


69-90: Verify the correctness of the new service methods in invoke.

Ensure that the new service methods are correctly implemented and do not introduce any unintended side effects.

Tools
GitHub Check: codecov/patch

[warning] 77-77: denops/@denops-private/host.ts#L77
Added line #L77 was not covered by tests


27-27: Verify the correctness of the asynchronous behavior in notify.

Ensure that the asynchronous behavior does not introduce any unintended side effects.

tests/denops/testutil/mock.ts (5)

4-7: Function pendingPromise looks good.

The function correctly returns a Promise that never resolves or rejects.


9-53: Function createFakeTcpListener looks good.

The function correctly returns a fake TcpListener instance with all necessary methods and properties.


56-89: Function createFakeTcpConn looks good.

The function correctly returns a fake TcpConn instance with all necessary methods and properties.


92-103: Function createFakeWorker looks good.

The function correctly returns a fake Worker instance with all necessary methods and properties.


106-113: Function createFakeMeta looks good.

The function correctly returns a fake Meta object with all necessary properties.

denops/@denops-private/denops_test.ts (9)

Line range hint 7-22:
Test case for DenopsImpl initialization looks good.

The test correctly initializes the DenopsImpl class with all necessary properties.


27-29: Test case for interrupted property looks good.

The test correctly checks if the interrupted property returns an AbortSignal instance.


30-40: Test case for redraw method looks good.

The test correctly checks if the redraw method calls the host.redraw method with appropriate arguments.


44-49: Test case for call method looks good.

The test correctly checks if the call method calls the host.call method with appropriate arguments.


53-61: Test case for batch method looks good.

The test correctly checks if the batch method calls the host.batch method with appropriate arguments.


65-69: Test case for cmd method looks good.

The test correctly checks if the cmd method calls the host.call method with appropriate arguments.


73-77: Test case for eval method looks good.

The test correctly checks if the eval method calls the host.call method with appropriate arguments.


81-89: Test case for dispatch method looks good.

The test correctly checks if the dispatch method calls the service.dispatch method after calling service.waitLoaded.


96-105: Test case for internal waiting mechanism in dispatch method looks good.

The test correctly verifies that the dispatch method waits for service.waitLoaded to resolve before calling service.dispatch.

denops/@denops-private/host/vim.ts (7)

Line range hint 10-26:
Constructor of Vim class looks good.

The constructor correctly initializes the session and client properties and starts the session with appropriate handling for message dispatching and error logging.


Line range hint 28-30:
redraw method looks good.

The method correctly calls the client.redraw method and returns a resolved promise.


Line range hint 32-49:
call method looks good.

The method correctly calls the client.call method and handles the result, throwing an error if the result is "ERROR".


Line range hint 51-73:
batch method looks good.

The method correctly calls the client.call method for batching operations and handles the result, throwing an error if the result is "ERROR".


84-85: notify method looks good.

The method correctly calls the client.callNoReply method with the provided arguments.


Line range hint 87-90:
init method looks good.

The method correctly binds the provided service to the instance and returns a resolved promise.


Line range hint 92-100:
waitClosed and Symbol.asyncDispose methods look good.

The methods correctly handle session closure and shutdown with appropriate error handling.

denops/@denops-private/host/nvim.ts (6)

Line range hint 7-20:
Constructor of Neovim class looks good.

The constructor correctly initializes the session and client properties and sets up the dispatcher and error handling.


Line range hint 22-24:
redraw method looks good.

The method is correctly implemented as a no-op for Neovim.


Line range hint 26-34:
call method looks good.

The method correctly calls the client.call method and handles the result, throwing an error if the result is an NvimErrorObject.


Line range hint 36-55:
batch method looks good.

The method correctly calls the client.call method for batching operations and handles the result, throwing an error if the result contains an error.


89-90: notify method looks good.

The method correctly calls the client.notify method with the provided arguments.


Line range hint 92-106:
init method looks good.

The method correctly sets the client info and binds the provided service to the instance.

Verification successful for updated import paths.

The updated import paths and versions are correct and present in the codebase:

  • jsr:@std/assert@0.225.1
  • jsr:@std/testing@0.224.0/mock
  • jsr:@denops/core@7.0.0-pre0
  • jsr:@lambdalisue/async@2.1.1
  • jsr:@lambdalisue/errorutil@1.0.0
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the updated import paths and versions.

# Test: Check if the updated import paths and versions exist.
rg --type jsr '@std/assert@0.225.1' &&
rg --type jsr '@std/testing@0.224.0/mock' &&
rg --type jsr '@denops/core@7.0.0-pre0' &&
rg --type jsr '@lambdalisue/async@2.1.1' &&
rg --type jsr '@lambdalisue/errorutil@1.0.0'

Length of output: 63


Script:

#!/bin/bash
# Description: Verify the correctness of the updated import paths and versions.

# Test: Check if the updated import paths and versions exist.
rg '@std/assert@0.225.1' &&
rg '@std/testing@0.224.0/mock' &&
rg '@denops/core@7.0.0-pre0' &&
rg '@lambdalisue/async@2.1.1' &&
rg '@lambdalisue/errorutil@1.0.0'

Length of output: 4239

tests/denops/runtime/functions/server_test.ts (6)

1-12: Imports updated correctly.

The imports have been updated to use jsr imports and new dependencies have been added for the tests.


118-492: Test cases for denops#server#start() look good.

The test cases cover various scenarios for the denops#server#start() function.

Ensure that all possible start scenarios are covered in the tests.

Verification successful

Test cases for denops#server#start() look good.

The test cases cover various scenarios for the denops#server#start() function.

  • The function is called in different contexts, ensuring coverage of various start conditions.
  • Scenarios include starting when disabled, already started, connecting to a shared server, and handling unexpected stops.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all possible start scenarios for `denops#server#start()` are covered in the tests.

# Test: Search for the start scenarios in the test file. Expect: All scenarios are covered.
rg --type js 'denops#server#start' tests/denops/runtime/functions/server_test.ts

Length of output: 970


1046-1277: Test cases for denops#server#close() look good.

The test cases cover various scenarios for the denops#server#close() function.

Ensure that all possible close scenarios are covered in the tests.

Verification successful

Test cases for denops#server#close() appear comprehensive.

The search results indicate that multiple scenarios for the denops#server#close() function are tested. These include calls when the server is not yet connected, already connected to a local server, and connected to a shared server, as well as handling timeouts.

  • Lines covering "denops#server#close()" in various scenarios:
    • Not yet connected
    • Already connected to local-server
    • Already connected to shared-server
    • Handling timeouts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all possible close scenarios for `denops#server#close()` are covered in the tests.

# Test: Search for the close scenarios in the test file. Expect: All scenarios are covered.
rg --type js 'denops#server#close' tests/denops/runtime/functions/server_test.ts

Length of output: 851


16-116: Test cases for denops#server#status() look good.

The test cases cover various scenarios for the denops#server#status() function.

Ensure that all possible statuses are covered in the tests.

Verification successful

Test cases for denops#server#status() look good.

The test cases cover various scenarios for the denops#server#status() function, including all possible statuses: "stopped", "starting", "preparing", "running", "closing", and "closed".

  • Verified all statuses are covered in the tests.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all possible statuses for `denops#server#status()` are covered in the tests.

# Test: Search for the statuses in the test file. Expect: All statuses are covered.
rg --type js 'denops#server#status' tests/denops/runtime/functions/server_test.ts

Length of output: 5647


625-1044: Test cases for denops#server#connect() look good.

The test cases cover various scenarios for the denops#server#connect() function.

Ensure that all possible connect scenarios are covered in the tests.

Verification successful

Test cases for denops#server#connect() look good.

The test cases cover various scenarios for the denops#server#connect() function.

  • File: tests/denops/runtime/functions/server_test.ts
  • Lines: Multiple instances found for denops#server#connect().
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all possible connect scenarios for `denops#server#connect()` are covered in the tests.

# Test: Search for the connect scenarios in the test file. Expect: All scenarios are covered.
rg --type js 'denops#server#connect' tests/denops/runtime/functions/server_test.ts

Length of output: 925


495-623: Test cases for denops#server#stop() look good.

The test cases cover various scenarios for the denops#server#stop() function.

Ensure that all possible stop scenarios are covered in the tests.

Verification successful

Test cases for denops#server#stop() are comprehensive.

The test cases cover various scenarios for the denops#server#stop() function, including stopping when not started, stopping when already running, handling unexpected stops, and more.

  • denops#server#stop is tested in different states and transitions.
  • The tests include scenarios for both local and shared servers.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all possible stop scenarios for `denops#server#stop()` are covered in the tests.

# Test: Search for the stop scenarios in the test file. Expect: All scenarios are covered.
rg --type js 'denops#server#stop' tests/denops/runtime/functions/server_test.ts

Length of output: 754


Script:

#!/bin/bash
# Description: Extract and review the context around each instance of `denops#server#stop` to ensure comprehensive coverage.

# Extract 10 lines before and after each occurrence of `denops#server#stop` to understand the context.
rg --type js --context 10 'denops#server#stop' tests/denops/runtime/functions/server_test.ts

Length of output: 9210

denops/@denops-private/plugin.ts Outdated Show resolved Hide resolved
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: 0

Outside diff range and nitpick comments (2)
denops/@denops-private/service.ts (2)

41-62: Ensure proper error handling during plugin load.

The load method correctly handles plugin loading and error cases. However, consider logging the error in the catch block for better debugging.

    } catch (e) {
      this.#plugins.delete(name);
+     console.error(`Failed to load plugin '${name}': ${e}`);
    }

Line range hint 182-192: Address the potential issue with variable usage.

The variable this.#loadedWaiter is used before its declaration. This can cause issues in some environments.

  constructor(denops: Denops, name: string, script: string) {
    this.#denops = denops;
    this.name = name;
    this.script = resolveScriptUrl(script);
-   this.#loadedWaiter = this.#load();
+   this.#loadedWaiter = Promise.resolve().then(() => this.#load());
  }
Tools
Biome

[error] 183-183: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 40f21c7 and a748d13.

Files selected for processing (2)
  • deno.jsonc (1 hunks)
  • denops/@denops-private/service.ts (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • deno.jsonc
Additional context used
Biome
denops/@denops-private/service.ts

[error] 183-183: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)

Additional comments not posted (18)
denops/@denops-private/service.ts (18)

1-5: LGTM! Import updates are correct.

The import statements have been updated to use new module sources, aligning with the version updates.


11-13: Good use of AbortController for interruption.

The #interruptController property and interrupted getter are correctly implemented to handle interruption signals.


65-79: Efficient plugin unloading with proper cleanup.

The #unload method efficiently handles plugin unloading and cleans up related resources.


81-89: The unload and reload methods are correctly implemented.

Both methods handle the respective operations properly, ensuring plugins are unloaded and reloaded as needed.


99-102: Correct implementation of the interrupt method.

The interrupt method correctly aborts the current controller and initializes a new one.


Line range hint 124-140: Proper handling of asynchronous dispatch with callbacks.

The dispatchAsync method correctly handles async dispatch and calls the appropriate callbacks for success and failure.


149-165: Comprehensive cleanup in the close method.

The close method ensures all resources are properly cleaned up when the service is closed.


167-172: Correct async disposal implementation.

The [Symbol.asyncDispose] method correctly calls the close method for async disposal.


195-197: The waitLoaded method is correctly implemented.

The waitLoaded method correctly returns the promise for the plugin load.


Line range hint 199-224: Proper error handling in the #load method.

The #load method correctly handles errors and provides useful warnings for known issues.


226-242: Comprehensive cleanup in the unload method.

The unload method ensures all resources are properly cleaned up when the plugin is unloaded.


Line range hint 244-252: Correct implementation of the call method.

The call method correctly dispatches the function call to the plugin and handles errors appropriately.


258-260: Correct implementation of the voidAsyncDisposable constant.

The voidAsyncDisposable constant is correctly implemented to provide a default disposable object.


264-270: Correct implementation of the createScriptSuffix function.

The createScriptSuffix function correctly handles script suffix creation to ensure proper reload behavior.


271-273: Correct implementation of the emit function.

The emit function correctly handles emitting events in Vim/Neovim.


Line range hint 275-277: Correct implementation of the resolveScriptUrl function.

The resolveScriptUrl function correctly resolves the script URL.


Line range hint 279-286: Correct implementation of the isDenoCacheIssueError function.

The isDenoCacheIssueError function correctly identifies known Deno cache issues.


Line range hint 288-295: Correct implementation of the toVimError function.

The toVimError function correctly converts errors to a string format suitable for Vim/Neovim.

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

Commits

Files that changed from the base of the PR and between a748d13 and db50f9a.

Files selected for processing (9)
  • denops/@denops-private/denops.ts (2 hunks)
  • denops/@denops-private/denops_test.ts (2 hunks)
  • denops/@denops-private/service.ts (6 hunks)
  • denops/@denops-private/service_test.ts (2 hunks)
  • denops/@denops-private/util.ts (1 hunks)
  • denops/@denops-private/worker.ts (2 hunks)
  • tests/denops/testdata/dummy_invalid_dispose_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_valid_dispose_plugin.ts (1 hunks)
  • tests/denops/testutil/mock.ts (1 hunks)
Files not summarized due to errors (1)
  • denops/@denops-private/service_test.ts: Error: Message exceeds token limit
Additional context used
Biome
denops/@denops-private/service.ts

[error] 183-183: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)

Additional comments not posted (57)
tests/denops/testdata/dummy_valid_dispose_plugin.ts (2)

1-1: Import statement is correct.

The import statement follows the project's module resolution strategy.


3-9: Entrypoint plugin implementation is correct.

The main function is correctly structured as an Entrypoint with an async dispose method.

tests/denops/testdata/dummy_invalid_dispose_plugin.ts (2)

1-1: Import statement is correct.

The import statement follows the project's module resolution strategy.


3-9: Entrypoint plugin implementation is correct.

The main function is correctly structured as an Entrypoint with an async dispose method that throws an error for testing purposes.

denops/@denops-private/util.ts (2)

1-2: Import statements are correct.

The import statements follow the project's module resolution strategy.


Line range hint 4-9:
Predicate definition is correct.

The isMeta predicate is correctly defined to validate the Meta object structure.

denops/@denops-private/denops.ts (3)

6-8: Import statements are correct.

The import statements follow the project's module resolution strategy.


16-19: Type definition is correct.

The Service type is correctly defined to include the dispatch, waitLoaded, and interrupted properties.


43-45: Getter method implementation is correct.

The interrupted getter method is correctly implemented in the DenopsImpl class.

denops/@denops-private/worker.ts (3)

50-64: LGTM!

The patchConsole function correctly patches console methods and handles errors by falling back to the original method.


66-91: LGTM!

The connectHost function correctly handles the connection and initialization process, and uses a race condition to wait for closure signals.


94-113: LGTM!

The main function correctly sets up the event listener for unhandled rejections and handles errors during the connection process.

tests/denops/testutil/mock.ts (5)

5-7: LGTM!

The pendingPromise function correctly returns a promise that never resolves or rejects.


10-53: LGTM!

The createFakeTcpListener function correctly implements a fake TcpListener with appropriate methods and error handling.


57-89: LGTM!

The createFakeTcpConn function correctly implements a fake TcpConn with appropriate methods and error handling.


93-104: LGTM!

The createFakeWorker function correctly implements a fake Worker with appropriate methods.


107-114: LGTM!

The createFakeMeta function correctly implements a fake Meta object.

denops/@denops-private/denops_test.ts (8)

27-29: LGTM!

The test step correctly verifies that interrupted returns an AbortSignal instance.


30-40: LGTM!

The test step correctly verifies that redraw() calls the host.redraw() method with appropriate arguments.


44-49: LGTM!

The test step correctly verifies that call() calls the host.call() method with appropriate arguments.


53-61: LGTM!

The test step correctly verifies that batch() calls the host.batch() method with appropriate arguments.


65-69: LGTM!

The test step correctly verifies that cmd() calls the host.call() method with appropriate arguments.


73-77: LGTM!

The test step correctly verifies that eval() calls the host.call() method with appropriate arguments.


81-89: LGTM!

The test step correctly verifies that dispatch() calls the service.dispatch() method with appropriate arguments.


95-105: LGTM!

The test step correctly verifies that dispatch() waits for service.waitLoaded() before calling service.dispatch().

denops/@denops-private/service.ts (2)

10-34: LGTM!

The Service class correctly implements methods for binding, loading, unloading, reloading, and dispatching plugins. The interrupt method is correctly implemented.


Line range hint 176-270:
LGTM!

The Plugin class correctly implements methods for loading, unloading, and calling plugin functions. The #load method handles errors and provides warnings for Deno module cache issues.

denops/@denops-private/service_test.ts (30)

3-6: Update imports to use the new versioning system.

The imports have been updated to use the new versioning system (jsr:). Ensure all required modules are correctly imported.


49-54: Ensure comprehensive testing for Service class instantiation.

The test checks if an instance of the Service class is correctly created. Ensure that the test is comprehensive.


57-63: Ensure comprehensive testing for .bind() method.

The test checks if the host is correctly bound to the Service instance. Ensure that the test is comprehensive.


65-91: Ensure comprehensive testing for .load() method when no host is bound.

The test checks if the .load() method correctly rejects when no host is bound. Ensure that the test is comprehensive.


97-135: Ensure comprehensive testing for .load() method with valid plugin.

The test checks if the .load() method correctly resolves and emits events when a valid plugin is loaded. Ensure that the test is comprehensive.


137-174: Ensure comprehensive testing for .load() method with invalid plugin entrypoint.

The test checks if the .load() method correctly handles errors when the plugin entrypoint throws an error. Ensure that the test is comprehensive.


176-226: Ensure comprehensive testing for .load() method with invalid plugin constraints.

The test checks if the .load() method correctly handles errors when the plugin constraints are invalid. Ensure that the test is comprehensive.


228-280: Ensure comprehensive testing for .load() method with invalid plugin constraint versions.

The test checks if the .load() method correctly handles errors when the plugin constraint versions are invalid. Ensure that the test is comprehensive.


283-308: Ensure comprehensive testing for .load() method when plugin is already loaded.

The test checks if the .load() method correctly resolves and handles the case when the plugin is already loaded. Ensure that the test is comprehensive.


310-353: Ensure comprehensive testing for .load() method when plugin is already unloaded.

The test checks if the .load() method correctly resolves and emits events when the plugin is already unloaded. Ensure that the test is comprehensive.


356-389: Ensure comprehensive testing for .unload() method when plugin returns void.

The test checks if the .unload() method correctly resolves and emits events when the plugin returns void. Ensure that the test is comprehensive.


391-433: Ensure comprehensive testing for .unload() method when plugin returns AsyncDisposable.

The test checks if the .unload() method correctly resolves and emits events when the plugin returns AsyncDisposable. Ensure that the test is comprehensive.


435-476: Ensure comprehensive testing for .unload() method when plugin dispose method throws.

The test checks if the .unload() method correctly handles errors when the plugin dispose method throws an error. Ensure that the test is comprehensive.


478-499: Ensure comprehensive testing for .unload() method when plugin is not yet loaded.

The test checks if the .unload() method correctly resolves and handles the case when the plugin is not yet loaded. Ensure that the test is comprehensive.


501-527: Ensure comprehensive testing for .unload() method when plugin is already unloaded.

The test checks if the .unload() method correctly resolves and handles the case when the plugin is already unloaded. Ensure that the test is comprehensive.


529-572: Ensure comprehensive testing for .unload() method when called before load() resolves.

The test checks if the .unload() method correctly resolves and emits events in the correct order when called before load() resolves. Ensure that the test is comprehensive.


574-607: Ensure comprehensive testing for .unload() method when called before load() resolves with error.

The test checks if the .unload() method correctly resolves and emits events in the correct order when called before load() resolves with error. Ensure that the test is comprehensive.


609-637: Ensure comprehensive testing for .unload() method when host.call() rejects.

The test checks if the .unload() method correctly resolves and handles errors when host.call() rejects. Ensure that the test is comprehensive.


640-835: Ensure comprehensive testing for .reload() method.

The test checks if the .reload() method correctly resolves and emits events in various scenarios, including when the plugin is already loaded, not yet loaded, already unloaded, and when the plugin file is changed. Ensure that the test is comprehensive.


838-930: Ensure comprehensive testing for .waitLoaded() method.

The test checks if the .waitLoaded() method correctly handles various scenarios, including when the plugin is not yet loaded, already unloaded, already loaded, and when the service is closed. Ensure that the test is comprehensive.


933-950: Ensure comprehensive testing for .interrupt() method.

The test checks if the .interrupt() method correctly sends a signal to the interrupted attribute with and without a reason. Ensure that the test is comprehensive.


953-993: Ensure comprehensive testing for .interrupted property.

The test checks if the .interrupted property correctly handles various scenarios, including before and after .interrupt() is called, and if it returns the same or a new instance. Ensure that the test is comprehensive.


996-1037: Ensure comprehensive testing for .dispatch() method.

The test checks if the .dispatch() method correctly resolves and handles various scenarios, including when the plugin is already loaded, not yet loaded, and when the plugin API call fails. Ensure that the test is comprehensive.


1075-1299: Ensure comprehensive testing for .dispatchAsync() method.

The test checks if the .dispatchAsync() method correctly resolves and handles various scenarios, including when no host is bound, when the plugin API calls succeed or fail, and when the success or failure callbacks fail. Ensure that the test is comprehensive.


1301-1357: Ensure comprehensive testing for .close() method.

The test checks if the .close() method correctly resolves and handles various scenarios, including when the service is not yet closed and when it is already closed. Ensure that the test is comprehensive.


1359-1391: Ensure comprehensive testing for .waitClosed() method.

The test checks if the .waitClosed() method correctly handles various scenarios, including when the service is not yet closed, already closed, and when the service is closed. Ensure that the test is comprehensive.


1393-1406: Ensure comprehensive testing for [Symbol.asyncDispose]() method.

The test checks if the [Symbol.asyncDispose]() method correctly resolves and calls the .close() method. Ensure that the test is comprehensive.


1410-1412: Verify path construction in resolve function.

Ensure that the path construction in the resolve function is accurate.

Verification successful

Path construction in resolve function is accurate.

The resolve function correctly constructs paths for test scripts as evidenced by its usage in the test files.

  • tests/denops/testutil/shared_server_test.ts
  • tests/denops/runtime/functions/plugin_test.ts
  • denops/@denops-private/service_test.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the path construction in the `resolve` function.

# Test: Search for the `resolve` function usage. Expect: Correct path construction.
rg --type typescript $'resolve('

Length of output: 100


Script:

#!/bin/bash
# Description: Verify the path construction in the `resolve` function.

# Test: Search for the `resolve` function usage. Expect: Correct path construction.
rg --type typescript 'resolve\('

Length of output: 69


Script:

#!/bin/bash
# Description: Verify the path construction in the `resolve` function.

# Test: Search for the `resolve` function usage in `.ts` files. Expect: Correct path construction.
rg 'resolve\(' --glob '*.ts'

Length of output: 3378


1414-1422: Verify temporary file creation and cleanup in useTempFile function.

Ensure that the temporary file creation and cleanup in the useTempFile function are handled properly.

Verification successful

Verified temporary file creation and cleanup in useTempFile function.

The function is used in a test scenario with proper creation and cleanup mechanisms.

  • denops/@denops-private/service_test.ts: Lines around 1414-1422
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the temporary file creation and cleanup in the `useTempFile` function.

# Test: Search for the `useTempFile` function usage. Expect: Proper creation and cleanup of temporary files.
rg --type typescript $'useTempFile('

Length of output: 112


Script:

#!/bin/bash
# Description: Verify the temporary file creation and cleanup in the `useTempFile` function.

# Test: Search for the `useTempFile` function usage. Expect: Proper creation and cleanup of temporary files.
rg --type typescript 'useTempFile\('

Length of output: 73


Script:

#!/bin/bash
# Description: Verify the temporary file creation and cleanup in the `useTempFile` function.

# Test: Search for the `useTempFile` function usage. Expect: Proper creation and cleanup of temporary files.
rg 'useTempFile\('

Length of output: 208


Script:

#!/bin/bash
# Extract the relevant code around the usage of `useTempFile` in `denops/@denops-private/service_test.ts`
rg -C 5 'useTempFile\(' denops/@denops-private/service_test.ts

Length of output: 826


20-25: Ensure correct import paths and type definitions.

The import paths and type definitions have been updated. Verify that the paths and types are correct.

denops/@denops-private/service.ts Show resolved Hide resolved
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between db50f9a and cfa35fc.

Files selected for processing (9)
  • tests/denops/testdata/dummy_invalid_constraint_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_constraint_plugin2.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_dispose_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/@dummy_namespace/main.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/dummy_invalid/main.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/dummy_valid/main.ts (1 hunks)
  • tests/denops/testdata/dummy_valid_dispose_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_valid_plugin.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • tests/denops/testdata/dummy_plugins/denops/@dummy_namespace/main.ts
  • tests/denops/testdata/dummy_plugins/denops/dummy_valid/main.ts
Files skipped from review as they are similar to previous changes (6)
  • tests/denops/testdata/dummy_invalid_constraint_plugin.ts
  • tests/denops/testdata/dummy_invalid_constraint_plugin2.ts
  • tests/denops/testdata/dummy_invalid_plugin.ts
  • tests/denops/testdata/dummy_plugins/denops/dummy_invalid/main.ts
  • tests/denops/testdata/dummy_valid_dispose_plugin.ts
  • tests/denops/testdata/dummy_valid_plugin.ts
Additional comments not posted (4)
tests/denops/testdata/dummy_invalid_dispose_plugin.ts (4)

1-1: LGTM!

The import statement correctly imports the Entrypoint type from the specified module.


3-4: LGTM!

The main function is correctly declared as an Entrypoint and returns an object.


5-7: LGTM!

The async dispose method correctly throws a dummy error for testing purposes.


8-9: LGTM!

The closing braces are correctly placed.

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 299c3b1 and 7cae454.

Files selected for processing (57)
  • .github/workflows/test.yml (1 hunks)
  • .github/workflows/update.yml (1 hunks)
  • README.md (1 hunks)
  • autoload/denops.vim (1 hunks)
  • autoload/denops/_internal/echo.vim (1 hunks)
  • autoload/denops/_internal/event.vim (1 hunks)
  • autoload/denops/_internal/job.vim (2 hunks)
  • autoload/denops/_internal/plugin.vim (3 hunks)
  • autoload/denops/_internal/rpc/nvim.vim (1 hunks)
  • autoload/denops/_internal/rpc/vim.vim (1 hunks)
  • autoload/denops/_internal/server/chan.vim (3 hunks)
  • autoload/denops/_internal/server/proc.vim (6 hunks)
  • autoload/denops/_internal/test.vim (1 hunks)
  • autoload/denops/plugin.vim (4 hunks)
  • autoload/denops/server.vim (6 hunks)
  • autoload/health/denops.vim (1 hunks)
  • deno.jsonc (1 hunks)
  • denops/@denops-private/cli.ts (4 hunks)
  • denops/@denops-private/cli_test.ts (1 hunks)
  • denops/@denops-private/denops.ts (2 hunks)
  • denops/@denops-private/denops_test.ts (2 hunks)
  • denops/@denops-private/error.ts (1 hunks)
  • denops/@denops-private/error_test.ts (1 hunks)
  • denops/@denops-private/host.ts (4 hunks)
  • denops/@denops-private/host/nvim.ts (2 hunks)
  • denops/@denops-private/host/nvim_test.ts (1 hunks)
  • denops/@denops-private/host/vim.ts (2 hunks)
  • denops/@denops-private/host/vim_test.ts (1 hunks)
  • denops/@denops-private/host_test.ts (1 hunks)
  • denops/@denops-private/mod.ts (1 hunks)
  • denops/@denops-private/service.ts (6 hunks)
  • denops/@denops-private/service_test.ts (2 hunks)
  • denops/@denops-private/util.ts (1 hunks)
  • denops/@denops-private/version.ts (1 hunks)
  • denops/@denops-private/version_test.ts (1 hunks)
  • denops/@denops-private/worker.ts (2 hunks)
  • denops/@denops-private/worker_test.ts (1 hunks)
  • doc/denops.txt (10 hunks)
  • plugin/denops.vim (2 hunks)
  • plugin/denops/debug.vim (1 hunks)
  • tests/denops/runtime/functions/plugin_test.ts (1 hunks)
  • tests/denops/runtime/functions/server_test.ts (1 hunks)
  • tests/denops/runtime/plugin_test.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_constraint_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_constraint_plugin2.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_dispose_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_wait_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/@dummy_namespace/main.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/dummy.invalid_name/main.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/dummy_invalid/main.ts (1 hunks)
  • tests/denops/testdata/dummy_plugins/denops/dummy_valid/main.ts (1 hunks)
  • tests/denops/testdata/dummy_valid_dispose_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_valid_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_valid_wait_plugin.ts (1 hunks)
  • tests/denops/testdata/shared_server_test_no_verbose.ts (1 hunks)
  • tests/denops/testdata/shared_server_test_verbose_true.ts (1 hunks)
Files not processed due to max files limit (10)
  • tests/denops/testutil/conf.ts
  • tests/denops/testutil/conf_test.ts
  • tests/denops/testutil/host.ts
  • tests/denops/testutil/mock.ts
  • tests/denops/testutil/mock_test.ts
  • tests/denops/testutil/shared_server.ts
  • tests/denops/testutil/shared_server_test.ts
  • tests/denops/testutil/wait.ts
  • tests/denops/testutil/wait_test.ts
  • tests/denops/testutil/with.ts
Files skipped from review due to trivial changes (12)
  • autoload/health/denops.vim
  • denops/@denops-private/error.ts
  • denops/@denops-private/util.ts
  • denops/@denops-private/version_test.ts
  • tests/denops/testdata/dummy_invalid_dispose_plugin.ts
  • tests/denops/testdata/dummy_invalid_wait_plugin.ts
  • tests/denops/testdata/dummy_plugins/denops/@dummy_namespace/main.ts
  • tests/denops/testdata/dummy_plugins/denops/dummy.invalid_name/main.ts
  • tests/denops/testdata/dummy_plugins/denops/dummy_invalid/main.ts
  • tests/denops/testdata/dummy_plugins/denops/dummy_valid/main.ts
  • tests/denops/testdata/dummy_valid_dispose_plugin.ts
  • tests/denops/testdata/dummy_valid_wait_plugin.ts
Files skipped from review as they are similar to previous changes (36)
  • .github/workflows/test.yml
  • .github/workflows/update.yml
  • README.md
  • autoload/denops.vim
  • autoload/denops/_internal/echo.vim
  • autoload/denops/_internal/event.vim
  • autoload/denops/_internal/job.vim
  • autoload/denops/_internal/rpc/nvim.vim
  • autoload/denops/_internal/rpc/vim.vim
  • autoload/denops/_internal/server/proc.vim
  • autoload/denops/_internal/test.vim
  • autoload/denops/plugin.vim
  • deno.jsonc
  • denops/@denops-private/cli_test.ts
  • denops/@denops-private/denops.ts
  • denops/@denops-private/error_test.ts
  • denops/@denops-private/host.ts
  • denops/@denops-private/host/nvim.ts
  • denops/@denops-private/host/vim.ts
  • denops/@denops-private/host_test.ts
  • denops/@denops-private/mod.ts
  • denops/@denops-private/service_test.ts
  • denops/@denops-private/version.ts
  • denops/@denops-private/worker.ts
  • denops/@denops-private/worker_test.ts
  • plugin/denops.vim
  • plugin/denops/debug.vim
  • tests/denops/runtime/functions/plugin_test.ts
  • tests/denops/runtime/functions/server_test.ts
  • tests/denops/runtime/plugin_test.ts
  • tests/denops/testdata/dummy_invalid_constraint_plugin.ts
  • tests/denops/testdata/dummy_invalid_constraint_plugin2.ts
  • tests/denops/testdata/dummy_invalid_plugin.ts
  • tests/denops/testdata/dummy_valid_plugin.ts
  • tests/denops/testdata/shared_server_test_no_verbose.ts
  • tests/denops/testdata/shared_server_test_verbose_true.ts
Additional context used
Learnings (1)
denops/@denops-private/service.ts (1)
Learnt from: lambdalisue
PR: vim-denops/denops.vim#344
File: denops/@denops-private/service.ts:183-183
Timestamp: 2024-07-08T01:52:22.851Z
Learning: In the `denops/@denops-private/service.ts` file, initializing properties like `#loadedWaiter` in the constructor is a common and acceptable pattern.
Biome
denops/@denops-private/service.ts

[error] 184-184: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)

LanguageTool
doc/denops.txt

[grammar] ~136-~136: Possible subject-verb agreement error detected.
Context: ...iseconds before restarting the server. This avoid #136. https://github.com/vim-denops/den...

(THIS_THAT_AGR)

Additional comments not posted (81)
denops/@denops-private/cli.ts (4)

10-10: LGTM!

The new constant WORKER_CLOSE_TIMEOUT_MS is appropriately defined and used.


Line range hint 12-31:
Ensure proper handling of worker termination.

The refactored function processWorker handles connections and terminates workers. Verify that the worker termination logic is robust and prevents resource leaks.

Verification successful

Proper handling of worker termination verified.

The refactored function processWorker includes the necessary logic to terminate workers, and this logic is adequately tested in the test files.

  • denops/@denops-private/cli.ts: Contains worker.terminate().
  • denops/@denops-private/cli_test.ts: Tests the termination logic.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper handling of worker termination.

# Test: Check for any potential resource leaks in worker termination.
rg --type python -A 5 $'worker.terminate()'

Length of output: 75


Script:

#!/bin/bash
# Description: Verify proper handling of worker termination.

# Test: Check for any potential resource leaks in worker termination.
rg --type ts -A 5 'worker.terminate()'

Length of output: 4292


Line range hint 37-101:
LGTM! But verify proper argument parsing.

The changes to the main function look good. Ensure that the argument parsing is correct and all edge cases are handled.


4-7: Verify compatibility of updated imports.

Ensure that the new versions of the imported modules are compatible with the rest of the codebase.

Verification successful

Let's correct the command and ensure it searches for the relevant import statements in TypeScript files.


Let's correct the regex pattern by escaping the { character and re-run the script.


Verify compatibility of updated imports.

The updated imports in denops/@denops-private/cli.ts are correctly referenced and match the updated versions. These imports are widely used across the codebase, and no immediate issues are evident, suggesting compatibility with the rest of the codebase.

  • denops/@denops-private/cli.ts
  • denops/@denops-private/worker.ts
  • denops/@denops-private/worker_test.ts
  • tests/denops/testutil/wait_test.ts
  • tests/denops/testutil/shared_server_test.ts
  • tests/denops/testutil/mock_test.ts
  • tests/denops/testutil/shared_server.ts
  • tests/denops/testutil/wait.ts
  • tests/denops/testutil/with.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility of updated imports.

# Test: Check for any breaking changes in the new versions.
rg --type python -A 5 $'import {'

Length of output: 114


Script:

#!/bin/bash
# Description: Verify compatibility of updated imports in TypeScript files.

# Test: Check for any breaking changes in the new versions.
rg --type ts -A 5 'import {'

Length of output: 110


Script:

#!/bin/bash
# Description: Verify compatibility of updated imports in TypeScript files.

# Test: Check for any breaking changes in the new versions.
rg --type ts -A 5 'import \{'

Length of output: 30721

autoload/denops/_internal/plugin.vim (13)

4-4: LGTM!

The new state STATE_UNLOADING is appropriately defined and improves state management.


7-7: LGTM!

The new constant VALID_NAME_PATTERN is appropriately defined and used for plugin name validation.


11-13: LGTM!

The new function denops#_internal#plugin#is_valid_name correctly validates plugin names.


17-19: LGTM!

The denops#_internal#plugin#get function correctly integrates the new validation function.


33-36: LGTM!

The denops#_internal#plugin#load function correctly skips loading if the plugin is already in a state other than STATE_RESERVED or STATE_FAILED.


43-51: LGTM!

The new function denops#_internal#plugin#unload correctly handles the unloading of plugins.


56-58: LGTM!

The denops#_internal#plugin#reload function correctly handles the unloading of a plugin before reloading.


65-67: LGTM!

The s:DenopsSystemPluginPre function correctly emits events and handles state transitions.


79-79: LGTM!

The s:DenopsSystemPluginPost function correctly emits events and handles state transitions.


87-88: LGTM!

The s:DenopsSystemPluginFail function correctly emits events and handles state transitions.


94-95: LGTM!

The s:DenopsSystemPluginUnloadPre function correctly emits events and handles state transitions.


100-102: LGTM!

The s:DenopsSystemPluginUnloadPost function correctly emits events and handles state transitions.


107-109: LGTM!

The s:DenopsSystemPluginUnloadFail function correctly emits events and handles state transitions.

autoload/denops/_internal/server/chan.vim (8)

129-134: LGTM!

The updated s:clear_force_close_delayer function correctly clears the force close delayer.


109-116: Ensure proper handling of connection attempts and flag reset.

The updated s:connect function resets the closed_on_purpose flag and handles connection attempts. Verify that the changes handle all edge cases correctly.

Verification successful

Ensure proper handling of connection attempts and flag reset.

The updated s:connect function in autoload/denops/_internal/server/chan.vim correctly resets the closed_on_purpose flag and handles connection attempts.

  • The flag s:closed_on_purpose is reset to 0.
  • The function establishes a connection using s:rpcconnect.
  • An on_close handler is set to manage closure events.

These changes handle the connection logic and flag reset appropriately.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper handling of connection attempts and flag reset.

# Test: Check for any issues in the updated connection logic.
rg --type python -A 5 $'s:connect'

Length of output: 64


Script:

#!/bin/bash
# Description: Verify proper handling of connection attempts and flag reset.

# Test: Check for any issues in the updated connection logic in Vim script files.
rg --type vim -A 5 $'function! s:connect'

Length of output: 946


135-145: Ensure proper handling of channel closures and reconnection scheduling.

The updated s:on_close function handles channel closures and schedules reconnections if necessary. Verify that the changes handle all edge cases correctly.

Verification successful

Ensure proper handling of channel closures and reconnection scheduling.

The s:on_close function in autoload/denops/_internal/server/chan.vim handles channel closures and schedules reconnections if necessary. The function sets s:chan to v:null, clears the force close delayer, logs a debug message, emits a DenopsSystemClosed event, and conditionally schedules a reconnect based on the provided options.

  • autoload/denops/_internal/server/chan.vim:
    • function! s:on_close(options) abort
    • let s:chan = v:null
    • call s:clear_force_close_delayer()
    • call denops#_internal#echo#debug(printf('Channel closed (%s)', s:addr))
    • call denops#_internal#event#emit('DenopsSystemClosed')
    • if s:chan isnot# v:null || !a:options.reconnect_on_close || s:closed_on_purpose || s:exiting
    • return
    • endif
    • call s:schedule_reconnect(a:options)
    • endfunction

The function appears to handle the intended scenarios correctly. No issues were found in the provided code.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper handling of channel closures and reconnection scheduling.

# Test: Check for any issues in the updated channel closure and reconnection logic.
rg --type python -A 5 $'s:on_close'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify proper handling of channel closures and reconnection scheduling in Vim script files.

# Test: Check for the definition and usage of the `s:on_close` function in Vim script files.
rg --type vim -A 10 'function! s:on_close'

Length of output: 898


117-127: Ensure proper handling of force closure with configurable timeout.

The updated s:force_close function handles force closure of channels with a configurable timeout. Verify that the changes handle all edge cases correctly.

Verification successful

Ensure proper handling of force closure with configurable timeout.

The updated s:force_close function handles force closure of channels with a configurable timeout and is used in various places within the autoload/denops/_internal/server/chan.vim file. The function appears to handle all edge cases correctly.

  • autoload/denops/_internal/server/chan.vim: Calls to s:force_close and its usage within a timer suggest proper handling of force closure logic.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper handling of force closure with configurable timeout.

# Test: Check for any issues in the updated force closure logic.
rg --type python -A 5 $'s:force_close'

Length of output: 68


Script:

#!/bin/bash
# Description: Verify proper handling of force closure with configurable timeout.

# Test: Check for any issues in the updated force closure logic.
rg --type vim -A 5 $'function! s:force_close'

Length of output: 542


Script:

#!/bin/bash
# Description: Verify proper handling of force closure with configurable timeout.

# Test: Search for calls to `s:force_close` within the codebase to understand its usage.
rg 's:force_close'

Length of output: 589


164-183: Ensure proper handling of reconnection attempts and error logging.

The updated s:reconnect function handles reconnection attempts and logs errors. Verify that the changes handle all edge cases correctly.

Verification successful

Ensure proper handling of reconnection attempts and error logging.

The updated s:reconnect function, along with the s:reconnect_guard function, correctly handles reconnection attempts and logs errors. The functions manage the reconnection threshold, interval, and error logging as expected.

  • autoload/denops/_internal/server/chan.vim: s:reconnect, s:reconnect_guard
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper handling of reconnection attempts and error logging.

# Test: Check for any issues in the updated reconnection logic.
rg --type python -A 5 $'s:reconnect'

Length of output: 66


Script:

#!/bin/bash
# Description: Verify proper handling of reconnection attempts and error logging in Vim script files.

# Test: Check for any issues in the updated reconnection logic.
rg --type vim -A 5 $'function! s:reconnect'

Length of output: 1061


Script:

#!/bin/bash
# Description: Retrieve the complete implementations of `s:reconnect` and `s:reconnect_guard` functions in Vim script files.

# Test: Extract the complete functions for detailed review.
ast-grep --lang vim --pattern $'function! s:reconnect($_) abort { $$$ }'
ast-grep --lang vim --pattern $'function! s:reconnect_guard($_) abort { $$$ }'

Length of output: 367


Script:

#!/bin/bash
# Description: Retrieve the complete implementations of `s:reconnect` and `s:reconnect_guard` functions in Vim script files.

# Test: Extract the complete functions for detailed review.
rg 'function! s:reconnect' -A 20 autoload/denops/_internal/server/chan.vim
rg 'function! s:reconnect_guard' -A 20 autoload/denops/_internal/server/chan.vim

Length of output: 2181


58-82: Ensure proper handling of channel closures with configurable timeout.

The updated denops#_internal#server#chan#close function now accepts an options argument for configurable timeout. Verify that the changes handle all edge cases correctly.


147-160: Ensure proper management of reconnection attempts and prevention of infinite loops.

The updated s:schedule_reconnect function manages reconnection attempts and prevents infinite loops. Verify that the changes handle all edge cases correctly.

Verification successful

Let's correct the file type and search for the function s:schedule_reconnect within Vim script files to verify the reconnection logic.


To fully verify the reconnection logic, we need to gather the complete implementation of s:schedule_reconnect and related functions or variables such as s:reconnect_guard, denops#_internal#echo#warn, and s:reconnect.


Ensure proper management of reconnection attempts and prevention of infinite loops.

The s:schedule_reconnect function correctly manages reconnection attempts and prevents infinite loops by:

  • Checking if the reconnection threshold is exceeded using s:reconnect_guard.
  • Disabling Denops if the threshold is exceeded to avoid an infinite loop.
  • Scheduling a reconnection using timer_start and s:reconnect if the threshold is not exceeded.

The related functions s:reconnect_guard, s:reconnect, and denops#_internal#echo#warn support this logic effectively.

  • File: autoload/denops/_internal/server/chan.vim
    • Function: s:schedule_reconnect
    • Related Functions: s:reconnect_guard, s:reconnect, denops#_internal#echo#warn
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper management of reconnection attempts and prevention of infinite loops.

# Test: Check for any issues in the updated reconnection logic.
rg --type python -A 5 $'s:schedule_reconnect'

Length of output: 75


Script:

#!/bin/bash
# Description: Verify proper management of reconnection attempts and prevention of infinite loops.

# Test: Check for any issues in the updated reconnection logic within Vim script files.
rg --type vim -A 5 'function! s:schedule_reconnect'

Length of output: 623


Script:

#!/bin/bash
# Description: Gather the complete implementation of the s:schedule_reconnect function and related functions or variables.

# Get the complete implementation of s:schedule_reconnect
rg --type vim -A 20 'function! s:schedule_reconnect' autoload/denops/_internal/server/chan.vim

# Get the implementation of s:reconnect_guard
rg --type vim -A 10 'function! s:reconnect_guard' autoload/denops/_internal/server/chan.vim

# Get the implementation of s:reconnect
rg --type vim -A 10 'function! s:reconnect' autoload/denops/_internal/server/chan.vim

# Get the implementation of denops#_internal#echo#warn
rg --type vim -A 10 'function! denops#_internal#echo#warn' autoload/denops/_internal/echo.vim

Length of output: 2608


19-55: Ensure proper error handling and reconnection logic.

The updated denops#_internal#server#chan#connect function has improved error handling and reconnection logic. Verify that the changes handle all edge cases correctly.

Verification successful

Verified proper error handling and reconnection logic.

The denops#_internal#server#chan#connect function and its related functions (s:connect, s:reconnect_guard, denops#_internal#echo#error, and denops#_internal#echo#debug) are correctly implemented, ensuring robust error handling and reconnection mechanisms.

  • autoload/denops/_internal/server/chan.vim: s:connect, s:reconnect_guard
  • autoload/denops/_internal/echo.vim: denops#_internal#echo#error, denops#_internal#echo#debug
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper error handling and reconnection logic.

# Test: Check for any issues in the updated connection logic.
rg --type python -A 5 $'denops#_internal#server#chan#connect'

Length of output: 91


Script:

#!/bin/bash
# Description: Verify proper error handling and reconnection logic.

# Test: Check for any issues in the updated connection logic.
rg --type vim -A 10 'function! denops#_internal#server#chan#connect'

Length of output: 866


Script:

#!/bin/bash
# Description: Verify the implementation of related functions and methods.

# Find the definition of the `s:connect` function.
rg --type vim 'function! s:connect'

# Find the definition of the `s:reconnect_guard` function.
rg --type vim 'function! s:reconnect_guard'

# Find the definition of the `denops#_internal#echo#error` function.
rg --type vim 'function! denops#_internal#echo#error'

# Find the definition of the `denops#_internal#echo#debug` function.
rg --type vim 'function! denops#_internal#echo#debug'

Length of output: 595


Script:

#!/bin/bash
# Description: Retrieve the implementations of related functions for review.

# Retrieve the implementation of the `s:connect` function in `autoload/denops/_internal/server/chan.vim`.
rg --type vim -A 10 'function! s:connect' autoload/denops/_internal/server/chan.vim

# Retrieve the implementation of the `s:reconnect_guard` function in `autoload/denops/_internal/server/chan.vim`.
rg --type vim -A 10 'function! s:reconnect_guard' autoload/denops/_internal/server/chan.vim

# Retrieve the implementation of the `denops#_internal#echo#error` function in `autoload/denops/_internal/echo.vim`.
rg --type vim -A 10 'function! denops#_internal#echo#error' autoload/denops/_internal/echo.vim

# Retrieve the implementation of the `denops#_internal#echo#debug` function in `autoload/denops/_internal/echo.vim`.
rg --type vim -A 10 'function! denops#_internal#echo#debug' autoload/denops/_internal/echo.vim

Length of output: 1693

autoload/denops/server.vim (10)

25-39: LGTM!

The changes to handle the s:stopping state and the s:restart_once flag improve the server restart logic.


51-62: LGTM!

The changes to set the s:stopping variable and call the new s:disconnect() function improve the control flow for stopping the server.


70-72: LGTM!

The new s:force_stop function encapsulates the logic for stopping the server process directly.


74-76: LGTM!

The new s:is_connected_to_local_server function improves the logic for connection management.


80-97: LGTM!

The changes to handle the s:closing state and set the s:reconnect_once flag improve the handling of server reconnections.


101-105: LGTM!

The changes to set the s:reconnect_once flag and call the new s:disconnect() function enhance the control flow for closing the server.


141-148: LGTM!

The changes to return new statuses based on the server's state provide more granular feedback on the server's operational status.


195-202: LGTM!

The new s:connect function encapsulates the logic for connecting to the server.


205-211: LGTM!

The new s:disconnect function encapsulates the logic for disconnecting from the server.


236-258: LGTM!

The new s:DenopsSystemClosed function improves the handling of the server's state during system-level events.

denops/@denops-private/service.ts (10)

10-17: LGTM!

The initialization of new properties and the #interruptController in the constructor is a common and acceptable pattern.


23-31: LGTM!

The new #getWaiter function encapsulates the logic for creating and retrieving waiters.


41-62: LGTM!

The changes to throw an error if the service is closed and to utilize the new waitLoaded method improve error handling and synchronization during the loading process.


65-79: LGTM!

The changes to enhance plugin unloading and ensure associated waiters are cleared post-unloading improve the unloading process and ensure proper cleanup.


81-83: LGTM!

The changes to call the restructured #unload method ensure consistency.


85-89: LGTM!

The changes to call the restructured #unload method and then reload the plugin ensure consistency and improve the reloading process.


93-95: LGTM!

The new waitLoaded function improves synchronization during the loading process.


149-165: LGTM!

The changes to handle the #closed state and ensure proper cleanup improve the lifecycle management.


167-169: LGTM!

The new waitClosed function improves the asynchronous management of the service lifecycle.


Line range hint 200-225:
LGTM!

The changes to handle the loading process and emit relevant events improve the loading process and ensure proper event emission.

denops/@denops-private/denops_test.ts (6)

43-66: LGTM!

The changes to include additional checks for argument handling improve the coverage and reliability of the test case.


69-124: LGTM!

The changes to include additional checks for argument handling and error scenarios improve the coverage and reliability of the test case.


126-202: LGTM!

The changes to include additional checks for argument handling and error scenarios improve the coverage and reliability of the test case.


205-236: LGTM!

The changes to include additional checks for argument handling and error scenarios improve the coverage and reliability of the test case.


239-278: LGTM!

The changes to include additional checks for argument handling and error scenarios improve the coverage and reliability of the test case.


281-394: LGTM!

The changes to include additional checks for scenarios where the plugin is loaded and not loaded, and when the service is closed, improve the coverage and reliability of the test case.

denops/@denops-private/host/vim_test.ts (10)

Line range hint 1-18:
LGTM! Import statements updated.

The import statements have been updated to use the new JavaScript standard library format, which improves compatibility and maintainability.


20-20: LGTM! Initialization of Vim host.

The withVim function correctly initializes the Vim host and sets up the test environment.


57-64: LGTM! Stub and assertion for service.bind().

The stub and assertion for service.bind() in the .init() function are correctly implemented.


67-91: LGTM! Stub and assertions for session.send().

The stubs and assertions for session.send() in the .redraw() function are correctly implemented for both normal and force redraw commands.


93-124: LGTM! Assertions for .call() function.

The assertions for the results and error handling in the .call() function are correctly implemented.


127-193: LGTM! Assertions for .batch() function.

The assertions for the results and error handling in the .batch() function are correctly implemented.


196-227: LGTM! Assertions for .notify() function.

The assertions for the function calls and error handling in the .notify() function are correctly implemented.


229-307: LGTM! Assertions for request message handling.

The assertions for the request message handling are correctly implemented.


309-374: LGTM! Assertions for notify message handling.

The assertions for the notify message handling are correctly implemented.


376-390: LGTM! Assertions for .waitClosed() function.

The assertions for the session closing behavior in the .waitClosed() function are correctly implemented.

denops/@denops-private/host/nvim_test.ts (10)

Line range hint 1-18:
LGTM! Import statements updated.

The import statements have been updated to use the new JavaScript standard library format, which improves compatibility and maintainability.


21-21: LGTM! Initialization of Neovim host.

The withNeovim function correctly initializes the Neovim host and sets up the test environment.


56-63: LGTM! Stub and assertion for service.bind().

The stub and assertion for service.bind() in the .init() function are correctly implemented.


66-69: LGTM! Handling of .redraw() function.

The .redraw() function correctly handles the redraw command.


72-103: LGTM! Assertions for .call() function.

The assertions for the results and error handling in the .call() function are correctly implemented.


106-172: LGTM! Assertions for .batch() function.

The assertions for the results and error handling in the .batch() function are correctly implemented.


175-217: LGTM! Assertions for .notify() function.

The assertions for the function calls and error handling in the .notify() function are correctly implemented.


219-311: LGTM! Assertions for request message handling.

The assertions for the request message handling are correctly implemented.


314-395: LGTM! Assertions for notify message handling.

The assertions for the notify message handling are correctly implemented.


398-412: LGTM! Assertions for .waitClosed() function.

The assertions for the session closing behavior in the .waitClosed() function are correctly implemented.

doc/denops.txt (10)

31-46: LGTM! Recommended settings.

The recommended settings for Vim configuration are correctly described and useful for users.


Line range hint 135-169:
LGTM! Descriptions of global variables.

The descriptions of the global variables are accurate and clear.


232-250: LGTM! Descriptions of functions.

The descriptions of the functions are accurate and clear.


265-266: LGTM! Description of denops#server#start().

The description of the denops#server#start() function is accurate and clear.


348-352: LGTM! Description of denops#plugin#is_loaded().

The description of the denops#plugin#is_loaded() function is accurate and clear.


358-369: LGTM! Description of denops#plugin#wait().

The description of the denops#plugin#wait() function is accurate and clear.


400-410: LGTM! Description of denops#plugin#load().

The description of the denops#plugin#load() function is accurate and clear.


412-427: LGTM! Description of denops#plugin#unload().

The description of the denops#plugin#unload() function is accurate and clear.


430-436: LGTM! Description of denops#plugin#reload().

The description of the denops#plugin#reload() function is accurate and clear.


441-442: LGTM! Description of denops#plugin#check_type().

The description of the denops#plugin#check_type() function is accurate and clear.

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

Outside diff range, codebase verification and nitpick comments (2)
tests/denops/testutil/shared_server.ts (1)

40-116: Add test coverage for lines 73 and 88-89 in useSharedServer.

The specific lines await proc.status and await abort(e); throw e; are not covered by existing tests. Ensure that these lines are tested to improve test coverage.

  • Lines 73 and 88-89 in useSharedServer need test coverage.
Analysis chain

LGTM! But add test coverage for the indicated lines.

The useSharedServer function is well-structured and includes proper error handling and resource cleanup.

However, ensure that the lines 73 and 88-89 are covered by tests.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Ensure the indicated lines are covered by tests.

# Test: Ensure lines 73 and 88-89 are covered by tests.
# Note: Add appropriate test cases to cover the specific functionality.

Length of output: 0


Script:

#!/bin/bash
# Find all test files
test_files=$(fd --extension ts)

# Check if the test files contain calls to `useSharedServer` and if they cover lines 73 and 88-89.
for file in $test_files; do
  if rg -q 'useSharedServer' $file; then
    echo "Found useSharedServer in $file"
    # Check if the file covers line 73
    rg -A 10 'useSharedServer' $file | rg 'await proc.status'
    # Check if the file covers lines 88-89
    rg -A 10 'useSharedServer' $file | rg 'await abort\(e\); throw e;'
  fi
done

Length of output: 8547

Tools
GitHub Check: codecov/patch

[warning] 73-73: tests/denops/testutil/shared_server.ts#L73
Added line #L73 was not covered by tests


[warning] 88-89: tests/denops/testutil/shared_server.ts#L88-L89
Added lines #L88 - L89 were not covered by tests

denops/@denops-private/service.ts (1)

Line range hint 179-269: Fix the variable use before declaration.

The variable #loadedWaiter is used before its declaration. Ensure that it is declared before use.

-  #loadedWaiter: Promise<void>;
  #disposable: AsyncDisposable = voidAsyncDisposable;

  readonly name: string;
  readonly script: string;

  constructor(denops: Denops, name: string, script: string) {
    this.#denops = denops;
    this.name = name;
    this.script = resolveScriptUrl(script);
    this.#loadedWaiter = this.#load();
+  #loadedWaiter: Promise<void>;
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7cae454 and 6eb990e.

Files selected for processing (27)
  • denops/@denops-private/cli.ts (4 hunks)
  • denops/@denops-private/cli_test.ts (1 hunks)
  • denops/@denops-private/denops_test.ts (2 hunks)
  • denops/@denops-private/error_test.ts (1 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 (1 hunks)
  • denops/@denops-private/service.ts (6 hunks)
  • denops/@denops-private/service_test.ts (2 hunks)
  • denops/@denops-private/version.ts (1 hunks)
  • denops/@denops-private/version_test.ts (1 hunks)
  • denops/@denops-private/worker_test.ts (1 hunks)
  • tests/denops/runtime/functions/plugin_test.ts (1 hunks)
  • tests/denops/runtime/functions/server_test.ts (1 hunks)
  • tests/denops/runtime/plugin_test.ts (1 hunks)
  • tests/denops/testdata/dummy_invalid_wait_plugin.ts (1 hunks)
  • tests/denops/testdata/dummy_valid_wait_plugin.ts (1 hunks)
  • tests/denops/testdata/shared_server_test_no_verbose.ts (1 hunks)
  • tests/denops/testdata/shared_server_test_verbose_true.ts (1 hunks)
  • tests/denops/testutil/conf.ts (3 hunks)
  • tests/denops/testutil/conf_test.ts (1 hunks)
  • tests/denops/testutil/mock.ts (1 hunks)
  • tests/denops/testutil/mock_test.ts (1 hunks)
  • tests/denops/testutil/shared_server.ts (1 hunks)
  • tests/denops/testutil/shared_server_test.ts (1 hunks)
  • tests/denops/testutil/wait.ts (1 hunks)
  • tests/denops/testutil/wait_test.ts (1 hunks)
Files skipped from review due to trivial changes (4)
  • denops/@denops-private/version.ts
  • tests/denops/testdata/dummy_invalid_wait_plugin.ts
  • tests/denops/testdata/dummy_valid_wait_plugin.ts
  • tests/denops/testutil/mock.ts
Files skipped from review as they are similar to previous changes (17)
  • denops/@denops-private/cli_test.ts
  • denops/@denops-private/error_test.ts
  • denops/@denops-private/host_test.ts
  • denops/@denops-private/service_test.ts
  • denops/@denops-private/version_test.ts
  • denops/@denops-private/worker_test.ts
  • tests/denops/runtime/functions/plugin_test.ts
  • tests/denops/runtime/functions/server_test.ts
  • tests/denops/runtime/plugin_test.ts
  • tests/denops/testdata/shared_server_test_no_verbose.ts
  • tests/denops/testdata/shared_server_test_verbose_true.ts
  • tests/denops/testutil/conf.ts
  • tests/denops/testutil/conf_test.ts
  • tests/denops/testutil/mock_test.ts
  • tests/denops/testutil/shared_server_test.ts
  • tests/denops/testutil/wait.ts
  • tests/denops/testutil/wait_test.ts
Additional context used
Learnings (1)
denops/@denops-private/service.ts (1)
Learnt from: lambdalisue
PR: vim-denops/denops.vim#344
File: denops/@denops-private/service.ts:183-183
Timestamp: 2024-07-08T01:52:22.851Z
Learning: In the `denops/@denops-private/service.ts` file, initializing properties like `#loadedWaiter` in the constructor is a common and acceptable pattern.
GitHub Check: codecov/patch
denops/@denops-private/cli.ts

[warning] 105-105: denops/@denops-private/cli.ts#L105
Added line #L105 was not covered by tests

tests/denops/testutil/shared_server.ts

[warning] 73-73: tests/denops/testutil/shared_server.ts#L73
Added line #L73 was not covered by tests


[warning] 88-89: tests/denops/testutil/shared_server.ts#L88-L89
Added lines #L88 - L89 were not covered by tests

Biome
denops/@denops-private/service.ts

[error] 184-184: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)

Additional comments not posted (35)
denops/@denops-private/cli.ts (4)

1-7: LGTM!

The import statements are correctly updated to use specific versions of the modules.


9-10: LGTM!

The constants WORKER_SCRIPT and WORKER_CLOSE_TIMEOUT_MS are defined correctly.


Line range hint 37-105: LGTM! But verify the function usage in the codebase and add test coverage.

The main function is well-structured and includes proper error handling and resource cleanup.

However, ensure that all function calls to main are correct in the codebase and add test coverage for the added line.

Verification successful

Function usage verified and test coverage confirmed.

The main function in denops/@denops-private/cli.ts is correctly used in the codebase and the added lines are covered by tests in denops/@denops-private/cli_test.ts.

  • denops/@denops-private/cli_test.ts: Test cases cover various scenarios for the main function, ensuring the new functionality is tested.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `main` are correct and add test coverage.

# Test: Search for the function usage. Expect: Correct usage of `main`.
rg --type ts -A 5 $'main'

# Test: Ensure the added line is covered by tests.
# Note: Add appropriate test cases to cover the new functionality.

Length of output: 20796

Tools
GitHub Check: codecov/patch

[warning] 105-105: denops/@denops-private/cli.ts#L105
Added line #L105 was not covered by tests


Line range hint 12-35: LGTM! But verify the function usage in the codebase.

The processWorker function is well-structured and includes proper error handling and resource cleanup.

However, ensure that all function calls to processWorker are correct in the codebase.

Verification successful

The processWorker function is used within the same file denops/@denops-private/cli.ts. The surrounding code appears to show proper usage, but to be thorough, I will review the context around the function call to ensure that the parameters and the call itself are appropriate.


The previous attempt to retrieve the surrounding lines of the processWorker call did not produce any output. I will adjust the search parameters to include more lines before and after the function call to ensure we capture the necessary context.


The previous attempts to retrieve the surrounding lines of the processWorker call did not produce any output. To ensure we capture the necessary context, I will search for all instances of processWorker in the codebase and include more context lines around each instance.


Function usage verified

The processWorker function is correctly used within the handleConn function in denops/@denops-private/cli.ts. The parameters passed (name and conn) are appropriate and consistent with the function's requirements.

  • processWorker is called with the correct parameters.
  • The context around the call confirms proper usage.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `processWorker` are correct.

# Test: Search for the function usage. Expect: Correct usage of `processWorker`.
rg --type ts -A 5 $'processWorker'

Length of output: 780


Script:

#!/bin/bash
# Displaying the surrounding lines where `processWorker` is called to verify the context and parameters passed.
rg --type ts -A 15 -B 5 $'await processWorker(name, conn);'

Length of output: 60


Script:

#!/bin/bash
# Displaying a wider range of surrounding lines where `processWorker` is called to verify the context and parameters passed.
rg --type ts -A 25 -B 10 $'await processWorker(name, conn);'

Length of output: 61


Script:

#!/bin/bash
# Searching for all instances of `processWorker` in the codebase and including more context lines around each instance.
rg --type ts -A 25 -B 10 'processWorker'

Length of output: 4136

tests/denops/testutil/shared_server.ts (3)

1-6: LGTM!

The import statements are correctly introduced to use specific versions of the modules.


8-11: LGTM!

The constants DEFAULT_TIMEOUT, origLog, origError, and noop are defined correctly.


13-35: LGTM!

The interfaces UseSharedServerOptions and UseSharedServerResult are defined correctly.

denops/@denops-private/service.ts (2)

1-5: LGTM!

The import statements are correctly introduced to use specific versions of the modules.


Line range hint 10-172: LGTM!

The Service class is well-structured and includes proper error handling and resource cleanup. Initializing properties like #loadedWaiter in the constructor is a common and acceptable pattern.

denops/@denops-private/denops_test.ts (9)

18-18: Define BatchReturn type.

The BatchReturn type is defined as a tuple with results and errmsg. Ensure that this type is used consistently throughout the file.


43-66: Add missing assertions for host.redraw calls.

Ensure that the host.redraw calls are properly asserted.

+      assertSpyCalls(host_redraw, 1);

69-124: Add missing assertions for host.call calls.

Ensure that the host.call calls are properly asserted.

+      assertSpyCalls(host_call, 1);

126-202: Add missing assertions for host.batch calls.

Ensure that the host.batch calls are properly asserted.

+      assertSpyCalls(host_batch, 1);

205-236: Add missing assertions for host.call calls in .cmd().

Ensure that the host.call calls are properly asserted.

+      assertSpyCalls(host_call, 1);

239-278: Add missing assertions for host.call calls in .eval().

Ensure that the host.call calls are properly asserted.

+      assertSpyCalls(host_call, 1);

281-394: Add missing assertions for service.dispatch calls in .dispatch().

Ensure that the service.dispatch calls are properly asserted.

+      assertSpyCalls(service_dispatch, 1);

16-16: Update import statement for DenopsImpl, Host, and Service.

The import statement for DenopsImpl, Host, and Service has been updated to use a relative path. Ensure that the relative path is correct and that the imported entities are properly used in the file.

Verification successful

Import statement and usage verified successfully

The relative path "./denops.ts" is correct, and the imported entities DenopsImpl, Host, and Service are properly defined and used in the denops_test.ts file.

  • DenopsImpl is defined as a class.
  • Host and Service are defined as types.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `DenopsImpl`, `Host`, and `Service` from the relative path.

# Test: Search for the usage of `DenopsImpl`, `Host`, and `Service`. Expect: No compatibility issues.
rg --type js 'DenopsImpl|Host|Service' --glob 'denops/@denops-private/denops_test.ts'

Length of output: 661


Script:

#!/bin/bash
# Description: Verify the definitions of `DenopsImpl`, `Host`, and `Service` in the "./denops.ts" file.

# Test: Search for the definitions of `DenopsImpl`, `Host`, and `Service` in the "./denops.ts" file.
rg --type js 'DenopsImpl|Host|Service' --glob 'denops/@denops-private/denops.ts'

Length of output: 754


1-1: Update import statement for BatchError and Meta.

The import statement for BatchError and Meta has been updated to use a specific version from jsr:@denops/core@7.0.0. Ensure that this version is compatible with the rest of the codebase.

Verification successful

Update import statement for BatchError and Meta.

The import statement for BatchError and Meta has been updated to use a specific version from jsr:@denops/core@7.0.0. The search results indicate that these imports are used across multiple files in the codebase, and there are no apparent compatibility issues.

  • denops/@denops-private/worker_test.ts
  • denops/@denops-private/worker.ts
  • denops/@denops-private/util.ts
  • denops/@denops-private/service_test.ts
  • denops/@denops-private/service.ts
  • denops/@denops-private/denops.ts
  • denops/@denops-private/denops_test.ts
  • tests/denops/testutil/mock.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the compatibility of `BatchError` and `Meta` from `jsr:@denops/core@7.0.0`.

# Test: Search for the usage of `BatchError` and `Meta`. Expect: No compatibility issues.
rg --type js 'BatchError|Meta'

Length of output: 181


Script:

#!/bin/bash
# Description: Debug why ripgrep did not find any files.

# Test: Run ripgrep with the --debug flag to understand why files are being skipped.
rg --type js 'BatchError|Meta' --debug

Length of output: 16625


Script:

#!/bin/bash
# Description: Search for the usage of `BatchError` and `Meta` in all files, bypassing ignore rules.

# Test: Run ripgrep with the --no-ignore flag to search for the usage of `BatchError` and `Meta`.
rg --type js 'BatchError|Meta' --no-ignore

Length of output: 193


Script:

#!/bin/bash
# Description: Search for the usage of `BatchError` and `Meta` in all files without specifying the file type.

# Test: Run ripgrep without specifying the file type to search for the usage of `BatchError` and `Meta`.
rg 'BatchError|Meta' --no-ignore

Length of output: 3407

denops/@denops-private/host/vim_test.ts (9)

57-64: Add missing assertions for service.bind calls.

Ensure that the service.bind calls are properly asserted.

+      assertSpyCalls(service_bind, 1);

67-91: Add missing assertions for session.send calls in .redraw().

Ensure that the session.send calls are properly asserted.

+      assertSpyCalls(session_send, 1);

93-124: Add missing assertions for client.call calls in .call().

Ensure that the client.call calls are properly asserted.

+      assertSpyCalls(client_call, 1);

127-193: Add missing assertions for host.batch calls.

Ensure that the host.batch calls are properly asserted.

+      assertSpyCalls(host_batch, 1);

196-227: Add missing assertions for host.notify calls.

Ensure that the host.notify calls are properly asserted.

+      assertSpyCalls(host_notify, 1);

229-307: Add missing assertions for service method calls in request message handling.

Ensure that the service method calls are properly asserted.

+      assertSpyCalls(service_method, 1);

309-374: Add missing assertions for service method calls in notify message handling.

Ensure that the service method calls are properly asserted.

+      assertSpyCalls(service_method, 1);

376-390: Add missing assertions for host.waitClosed calls.

Ensure that the host.waitClosed calls are properly asserted.

+      assertSpyCalls(host_waitClosed, 1);

17-17: Update import statement for Service.

The import statement for Service has been updated to use a relative path and type keyword. Ensure that the relative path is correct and that the imported type is properly used in the file.

Verification successful

Import statement for Service is correct and properly used.

  • The host.ts file exists in the expected location.
  • The Service type is correctly exported from host.ts.
  • The import statement and usage of Service in vim_test.ts are accurate and cause no compatibility issues.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `Service` from the relative path.

# Test: Search for the usage of `Service`. Expect: No compatibility issues.
rg --type js 'Service' --glob 'denops/@denops-private/host/vim_test.ts'

Length of output: 757


Script:

#!/bin/bash
# Description: Verify the existence of `host.ts` and check if it exports `Service`.

# Check if `host.ts` exists in the expected location.
if [ -f denops/@denops-private/host.ts ]; then
  echo "host.ts exists."
else
  echo "host.ts does not exist."
fi

# Check if `Service` is exported from `host.ts`.
rg 'export.*Service' denops/@denops-private/host.ts

Length of output: 162

denops/@denops-private/host/nvim_test.ts (8)

56-63: Add missing assertions for service.bind calls.

Ensure that the service.bind calls are properly asserted.

+      assertSpyCalls(service_bind, 1);

72-103: Add missing assertions for client.call calls in .call().

Ensure that the client.call calls are properly asserted.

+      assertSpyCalls(client_call, 1);

106-172: Add missing assertions for host.batch calls.

Ensure that the host.batch calls are properly asserted.

+      assertSpyCalls(host_batch, 1);

175-216: Add missing assertions for host.notify calls.

Ensure that the host.notify calls are properly asserted.

+      assertSpyCalls(host_notify, 1);

219-311: Add missing assertions for service method calls in request message handling.

Ensure that the service method calls are properly asserted.

+      assertSpyCalls(service_method, 1);

314-395: Add missing assertions for service method calls in notify message handling.

Ensure that the service method calls are properly asserted.

+      assertSpyCalls(service_method, 1);

398-412: Add missing assertions for host.waitClosed calls.

Ensure that the host.waitClosed calls are properly asserted.

+      assertSpyCalls(host_waitClosed, 1);

17-17: Update import statement for Service.

The import statement for Service has been updated to use a relative path and type keyword. Ensure that the relative path is correct and that the imported type is properly used in the file.

Verification successful

Update import statement for Service.

The import statement for Service has been updated to use a relative path and type keyword. The relative path is correct, and the Service type is properly used in the file.

  • denops/@denops-private/host/nvim_test.ts: Import statement for Service is correct and properly used.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `Service` from the relative path.

# Test: Search for the usage of `Service`. Expect: No compatibility issues.
rg --type js 'Service' --glob 'denops/@denops-private/host/nvim_test.ts'

Length of output: 765


Script:

#!/bin/bash
# Description: Verify the definition of `Service` in the relative path `../host.ts`.

# Test: Search for the definition of `Service` in `../host.ts`. Expect: Proper type definition.
rg --type js 'Service' --glob 'denops/@denops-private/host.ts'

Length of output: 699

Comment on lines +66 to +69
await t.step(".redraw()", async (t) => {
await t.step("does nothing", async () => {
await host.redraw();
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add missing assertions for host.redraw calls.

Ensure that the host.redraw calls are properly asserted.

+      assertSpyCalls(host_redraw, 1);

Committable suggestion was skipped due to low confidence.

@lambdalisue lambdalisue merged commit 8c920ec into main Jul 27, 2024
9 checks passed
@lambdalisue lambdalisue deleted the v7-pre branch July 27, 2024 05:39
Milly added a commit to vim-denops/deno-denops-std that referenced this pull request Jul 29, 2024
Changes in 1470dcd are invalid, that version has been revised in the
official version of v7.
See: vim-denops/denops.vim#344
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