-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💪 Refactoring for denops v6 #292
Conversation
WalkthroughThe changes across the codebase reflect a significant refactoring effort, focusing on simplifying function signatures, updating dependencies, and enhancing type safety. Deprecated functionalities have been removed, and there's a shift towards using promises and type guards. The updates also include performance logging enhancements and a move towards stricter version control in imports. Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChat with CodeRabbit Bot (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #292 +/- ##
==========================================
+ Coverage 92.59% 96.42% +3.83%
==========================================
Files 3 3
Lines 81 84 +3
Branches 6 5 -1
==========================================
+ Hits 75 81 +6
+ Misses 6 3 -3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (14)
- autoload/denops/plugin.vim (2 hunks)
- denops/@denops-private/cli.ts (2 hunks)
- denops/@denops-private/error.ts (1 hunks)
- denops/@denops-private/host/base.ts (2 hunks)
- denops/@denops-private/host/invoker.ts (2 hunks)
- denops/@denops-private/host/nvim.ts (3 hunks)
- denops/@denops-private/host/vim.ts (3 hunks)
- denops/@denops-private/impl.ts (3 hunks)
- denops/@denops-private/impl_test.ts (1 hunks)
- denops/@denops-private/service.ts (5 hunks)
- denops/@denops-private/util.ts (1 hunks)
- denops/@denops-private/version.ts (1 hunks)
- denops/@denops-private/worker/script.ts (3 hunks)
- doc/denops.txt (2 hunks)
Files skipped from review due to trivial changes (3)
- denops/@denops-private/error.ts
- denops/@denops-private/impl_test.ts
- denops/@denops-private/version.ts
Additional comments: 38
autoload/denops/plugin.vim (4)
59-81:
The deprecation logic indenops#plugin#register
is well-implemented, providing clear instructions for users to update their code.84-93:
The deprecation logic indenops#plugin#reload
is well-implemented, providing clear instructions for users to update their code.96-108:
The deprecation logic indenops#plugin#discover
is well-implemented, providing clear instructions for users to update their code.141-147:
Thes:register
function correctly implements the simplified plugin registration process.denops/@denops-private/cli.ts (2)
1-6:
The import statements have been updated to the newer versions as described in the summary. Ensure that these updates do not introduce breaking changes and that all dependent code has been updated accordingly.49-52:
TheparseArgs
function is used correctly with the appropriate options for command line arguments. Ensure that all scripts and documentation that rely on the CLI have been updated to reflect any changes in the available options.denops/@denops-private/host/base.ts (2)
1-3:
The change to importInvoker
as a type is appropriate since it's only used for type annotations.18-23:
The changes to thebatch
method's signature, using readonly tuples for both parameters and return types, enhance type safety and immutability.denops/@denops-private/host/invoker.ts (2)
1-2:
The import statements have been updated correctly to reflect the changes in the summary.11-17:
Theregister
andreload
methods in theInvoker
class have been updated to accept fewer parameters and return promises, aligning with the summary's description of the changes.denops/@denops-private/host/nvim.ts (2)
74-90:
The refactoring of thebatch
function to useensure
for result validation and to return a readonly tuple aligns with the summary and enhances type safety. The error handling within the function is also correctly implemented.111-113:
The simplification of thewaitClosed
function to return a promise directly is consistent with the refactoring goals and aligns with the summary.denops/@denops-private/host/vim.ts (4)
1-8:
The import statements are correctly updated to reflect the new dependencies and type imports.10-20:
The introduction of type predicatesisCallReturn
andisBatchReturn
enhances type safety for thecall
andbatch
methods.37-58:
The refactoring of thecall
andbatch
methods to use promises andensure
for error handling aligns with the goal of enhancing type safety and error handling.100-102:
Thedispatch
function correctly uses the newisInvokeMessage
predicate to ensure the correct message format is being processed.denops/@denops-private/impl.ts (8)
1-4:
The addition ofensure
andis
from the external module aligns with the refactoring goals of enhancing type safety and error handling.16-16:
The introduction ofisBatchReturn
is a good practice for ensuring the type safety of batch operation results.42-43:
Theredraw
function correctly returns a promise directly, aligning with the promise-oriented approach mentioned in the summary.46-47:
Thecall
function has been updated to return the result of the session call directly, which is consistent with the refactoring goals.50-62:
Thebatch
function's refactoring to useensure
for result validation and to throw aBatchError
when needed is a good enhancement for error handling.65-66:
Thecmd
function has been updated to return a promise directly, which is consistent with the changes described in the summary.69-70:
Theeval
function has been updated to return the result of the session call directly, which is consistent with the refactoring goals.73-79:
Thedispatch
function has been updated to return the result of the session call directly, aligning with the promise-oriented approach.denops/@denops-private/service.ts (6)
1-21:
The imports have been updated to newer versions, and theensure
function has been added, which aligns with the summary.48-58:
Theregister
method has been correctly updated to be asynchronous and themeta
andoptions
parameters have been removed as per the summary.68-79:
The use ofperformance.now()
as a suffix for the script URL inworker.postMessage
is a good practice to avoid caching issues when reloading scripts.83-98:
Thereload
method has been correctly updated to be asynchronous and themeta
andoptions
parameters have been removed as per the summary.112-136:
Thedispose
method has been updated to asynchronously dispose of all plugins, which is consistent with the summary.143-173:
The dispatcher methods have been updated, and thetrace
parameter has been removed, which is consistent with the summary.denops/@denops-private/util.ts (1)
- 1-9:
The implementation of the
isMeta
predicate function correctly validates theMeta
type according to the provided summary. The use of theis
utility and TypeScript's type system is appropriate and follows best practices for type safety and validation.denops/@denops-private/worker/script.ts (5)
18-20:
The newisMessageData
validation object correctly checks for the structure of the incoming message data, ensuring type safety.23-26:
Theemit
function is a good abstraction for event emission, and the error handling within it is appropriate for avoiding unhandled promise rejections.28-36:
The removal of thetrace
parameter from themain
function is consistent with the summary, and the function does not referencetrace
elsewhere.72-84:
The try-catch block in themain
function correctly handles the plugin lifecycle events and ensures that the worker is closed properly after execution or in case of an error.89-96:
The event listener correctly uses theensure
function withisMessageData
for data validation, which is a good practice for type safety and error prevention.doc/denops.txt (2)
84-90:
The summary mentions the removal ofg:denops#trace
, but this hunk showsg:denops#debug
. Please clarify ifg:denops#debug
should be removed or if the summary should be updated.262-289:
The changes to the documentation of the plugin functions align with the summary provided, reflecting the simplified function signatures and removal of deprecated options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- autoload/denops/plugin.vim (2 hunks)
Additional comments: 4
autoload/denops/plugin.vim (4)
59-81:
The refactoring ofdenops#plugin#register
correctly handles the deprecation of the old call patterns and ensures that the function can only be called with the correct number of arguments post-deprecation.84-93:
The refactoring ofdenops#plugin#reload
correctly handles the deprecation of theoptions
argument and ensures that no additional arguments are processed.96-108:
The refactoring ofdenops#plugin#discover
correctly handles the deprecation of theoptions
argument and ensures that no additional arguments are processed.141-147:
The refactoring ofs:register
correctly updates the function signature to accept only theplugin
andscript
arguments and correctly implements the registration logic.
a52f086
to
f677826
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 3
Configuration used: CodeRabbit UI
Files selected for processing (16)
- autoload/denops/_internal/server/chan.vim (1 hunks)
- autoload/denops/_internal/server/proc.vim (1 hunks)
- autoload/denops/plugin.vim (2 hunks)
- denops/@denops-private/cli.ts (3 hunks)
- denops/@denops-private/error.ts (1 hunks)
- denops/@denops-private/host/base.ts (2 hunks)
- denops/@denops-private/host/invoker.ts (2 hunks)
- denops/@denops-private/host/nvim.ts (4 hunks)
- denops/@denops-private/host/vim.ts (3 hunks)
- denops/@denops-private/impl.ts (3 hunks)
- denops/@denops-private/impl_test.ts (1 hunks)
- denops/@denops-private/service.ts (5 hunks)
- denops/@denops-private/util.ts (1 hunks)
- denops/@denops-private/version.ts (1 hunks)
- denops/@denops-private/worker/script.ts (3 hunks)
- doc/denops.txt (2 hunks)
Files skipped from review due to trivial changes (2)
- denops/@denops-private/error.ts
- denops/@denops-private/version.ts
Additional comments: 49
autoload/denops/_internal/server/chan.vim (1)
- 93-97:
The change fromdoautocmd User DenopsReady
tocall s:rpcnotify(s:chan, 'void', [])
is a significant alteration in the event notification mechanism. Ensure that all dependent features and plugins are compatible with this new approach.autoload/denops/_internal/server/proc.vim (1)
- 67-77:
The conditional logic for appending the--quiet
flag based on theg:denops#debug
variable is correctly implemented and aligns with the summary.autoload/denops/plugin.vim (4)
57-82:
The refactoring ofdenops#plugin#register
function correctly handles backward compatibility by providing deprecation warnings and fallbacks for the old function signatures.84-93:
The refactoring ofdenops#plugin#reload
function correctly includes a deprecation warning for the removedoptions
argument.96-108:
The refactoring ofdenops#plugin#discover
function correctly includes a deprecation warning for the removedoptions
argument and iterates over discovered plugins to register them.141-147:
Thes:register
function has been updated to match the new plugin registration process, and it correctly notifies the denops server to invoke the 'register' command with the necessary arguments.denops/@denops-private/cli.ts (3)
1-8:
The import changes align with the summary provided and reflect the updated dependencies and utilities.57-60:
The usage ofparseArgs
for parsing command-line arguments is correct and the options are properly configured.69-75:
The use ofconsole.log
for printing the identity is correct, and the use ofconsole.warn
for the listening address and port is consistent with the other uses ofconsole.warn
in the code.denops/@denops-private/host/base.ts (2)
1-3:
The change to importInvoker
as a type is appropriate since it's only used for type information.18-23:
The changes to thebatch
function's parameter and return types enhance type safety and immutability, which are beneficial for the codebase.denops/@denops-private/host/invoker.ts (2)
1-2:
The import statements have been correctly updated to the new versions and paths as per the summary.11-17:
Theregister
andreload
methods have been correctly updated to accept fewer parameters, aligning with the refactoring goals.denops/@denops-private/host/nvim.ts (7)
1-5:
The import from "unknownutil" has been updated to v3.11.0, which aligns with the pull request summary mentioning the use of the latest version ofensure
andis
utilities.15-23:
The addition ofisNvimCallFunctionReturn
for type checking aligns with the pull request's focus on enhancing type safety.30-31:
The constructor of theNeovim
class has been modified, and the#invoker
property has been added to the class, as per the summary.34-58:
The#session
setup and dispatcher methods have been refactored to useensurePromise
for handling invoker methods, which is consistent with the pull request's focus on error handling and validation.94-109:
Thebatch
method signature has been updated to enhance type safety by using readonly tuples, which is in line with the pull request's focus on type safety enhancements.112-114:
Theregister
method has been updated to assign theinvoker
to the#invoker
property, which is consistent with the summary.129-131:
The addition of theensurePromise
function to handle both synchronous and asynchronous values aligns with the pull request's focus on error handling and validation.denops/@denops-private/host/vim.ts (7)
10-26:
The introduction of new type guardsisCallReturn
,isBatchReturn
,isVoidMessage
, andisInvokeMessage
enhances type safety and ensures that the data conforms to expected types before processing.57-57:
The change to return a resolved Promise from theredraw
method aligns with the asynchronous nature of the method and ensures consistency with other methods that return a Promise.60-70:
The refactoring of thecall
method to return a Promise and use theensure
function for runtime type checking is a good practice, as it improves error handling and ensures that the returned value is of the expected type.72-78:
The update to thebatch
method to return a Promise with a readonly array as the result is a good practice, as it enforces immutability of the returned data and enhances type safety.80-82:
The update to theregister
method to assign theinvoker
to a class property is a straightforward change that simplifies the method's implementation.84-102:
The introduction of the private method#dispatch
centralizes message processing, which can improve maintainability and make the class easier to understand.113-114:
Thedispose
method's handling of the session shutdown with a try-catch block that ignores errors is a common pattern for cleanup functions, ensuring that any errors during shutdown do not impact the disposal process.denops/@denops-private/impl.ts (5)
16-16:
The definition ofisBatchReturn
correctly uses theis
utility to ensure the structure of the batch return value.46-47:
Thecall
function correctly returns the result of the session call directly.50-62:
Thebatch
function correctly handles the session call result, usingensure
for validation and throwing aBatchError
when appropriate.69-70:
Theeval
function correctly returns the result of the session call directly.73-79:
Thedispatch
function correctly returns the result of the session call directly.denops/@denops-private/impl_test.ts (2)
1-7:
The import paths have been updated to the newer version of the Deno standard library, which is consistent with the summary.14-30:
The new test step "denops.redraw() does nothing" correctly asserts thatdenops.redraw()
returnsundefined
for different arguments, aligning with the intended behavior.denops/@denops-private/service.ts (8)
60-63:
The implementation of a cache-busting mechanism using a timestamp as a URL fragment is a good practice to ensure that the latest version of the script is loaded, especially when reloading plugins.78-90:
The simplification of thereload
method by removing unused parameters and relying on the stored script path is a good refactor for maintainability and clarity.107-109:
UsingPromise.all
to dispose of plugins concurrently is a good practice for performance, as it allows for parallel cleanup operations.137-140:
Thereload
dispatcher method correctly asserts the type of thetrace
parameter and handles the reload operation without using the deprecatedtrace
parameter.143-145:
Theredraw
dispatcher method correctly asserts the type of theforce
parameter and delegates the redraw operation to the host, which is a clean and type-safe implementation.148-151:
Thecall
dispatcher method correctly asserts the types of thefn
andargs
parameters and delegates the call operation to the host, ensuring type safety and proper delegation.154-156:
Thebatch
dispatcher method correctly asserts the type of thecalls
parameter and delegates the batch operation to the host, which is a good practice for type safety and code clarity.159-163:
Thedispatch
dispatcher method correctly asserts the types of thename
,fn
, andargs
parameters and handles the dispatch operation within the service, ensuring type safety and proper internal delegation.denops/@denops-private/util.ts (1)
- 4-9:
TheisMeta
predicate function correctly validates theMeta
type properties using theis
utility. The use ofas const
for literal types is appropriate, and the code is modular and maintainable.denops/@denops-private/worker/script.ts (4)
1-14:
The import ofisMeta
is still present, which is correct as it is being used in theisMessageData
object definition. No action is needed here.18-20:
TheisMessageData
object definition correctly usesisMeta
to validate themeta
property, ensuring the data structure is as expected.72-84:
Themain
function has been updated to include proper error handling and event emission, which aligns with the summary of changes.89-96:
The event listener for the worker correctly usesensure
andisMessageData
to validate the incoming message data, which is in line with the summary of changes.doc/denops.txt (2)
84-90:
The hunk correctly reflects the removal ofg:denops#trace
and the presence ofg:denops#debug
.262-288:
The hunk correctly reflects the updated function signatures fordenops#plugin#discover
,denops#plugin#register
, anddenops#plugin#reload
functions, aligning with the summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (17)
- autoload/denops.vim (1 hunks)
- autoload/denops/_internal/server/chan.vim (1 hunks)
- autoload/denops/_internal/server/proc.vim (1 hunks)
- autoload/denops/plugin.vim (2 hunks)
- denops/@denops-private/cli.ts (3 hunks)
- denops/@denops-private/error.ts (1 hunks)
- denops/@denops-private/host/base.ts (2 hunks)
- denops/@denops-private/host/invoker.ts (2 hunks)
- denops/@denops-private/host/nvim.ts (4 hunks)
- denops/@denops-private/host/vim.ts (3 hunks)
- denops/@denops-private/impl.ts (3 hunks)
- denops/@denops-private/impl_test.ts (1 hunks)
- denops/@denops-private/service.ts (5 hunks)
- denops/@denops-private/util.ts (1 hunks)
- denops/@denops-private/version.ts (1 hunks)
- denops/@denops-private/worker/script.ts (3 hunks)
- doc/denops.txt (2 hunks)
Files skipped from review due to trivial changes (3)
- autoload/denops.vim
- denops/@denops-private/error.ts
- denops/@denops-private/version.ts
Additional comments: 52
autoload/denops/_internal/server/chan.vim (1)
- 95-96: The change from triggering an autocmd event to invoking an RPC notification may affect plugins or parts of the codebase that rely on the
DenopsReady
event. Ensure that all dependent code has been updated to handle this new notification mechanism.autoload/denops/_internal/server/proc.vim (1)
- 67-78: The conditional addition of the '--quiet' flag based on the
g:denops#debug
variable is a good approach to control the verbosity of the output. Ensure thatg:denops#debug
is defined before this code is executed to avoid any runtime errors.autoload/denops/plugin.vim (4)
59-81: The deprecation warnings and conditional logic for handling different argument combinations in
denops#plugin#register
are correctly implemented.84-93: The deprecation warning and the updated call to
denops#server#notify
indenops#plugin#reload
are correctly implemented.96-108: The deprecation warning in
denops#plugin#discover
and the loop that registers discovered plugins are correctly implemented.141-147: The
s:register
function has been correctly updated to match the new function signature that accepts only two arguments.denops/@denops-private/cli.ts (4)
1-8: The imports have been updated to use newer versions of dependencies and additional utilities like
ensure
andisMeta
. Ensure that these new utilities are used correctly throughout the codebase.26-60: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [26-75]
The use of
console.warn
for logging connection information and performance measurements is unconventional but may be intentional to highlight these messages. Ensure that this aligns with the intended logging strategy.
57-60: The
parseArgs
function is used to parse command-line arguments, and the parsed arguments are used to set up the listener and control logging verbosity. Ensure that the arguments are handled correctly in all relevant parts of the codebase.69-74: The
console.log
statement is used to output the local address when theidentity
flag is set, andconsole.warn
is used to log the listening address. Ensure that this is consistent with the intended output and logging strategy.denops/@denops-private/host/base.ts (3)
1-2: The change to import
Invoker
as a type is appropriate since it seems to be used only for type annotations within this file.21-23: The use of readonly tuples for the
calls
parameter in thebatch
function is a good practice as it enforces immutability, ensuring that the input cannot be modified.23-23: The update to the return type of the
batch
function to use readonly tuples is consistent with the immutability enforced on thecalls
parameter, ensuring that the returned array elements cannot be modified.denops/@denops-private/host/invoker.ts (2)
1-1: The import statement for the
is
module has been updated to version 3.11.0. Ensure that this version is compatible with the rest of the codebase and that all uses of theis
module have been tested with the new version.11-17: The
register
andreload
methods have been simplified to accept fewer parameters. Ensure that all calls to these methods have been updated accordingly and that the removed parameters (meta
,options
, andtrace
) are no longer required or have been handled differently in the codebase.denops/@denops-private/host/nvim.ts (7)
3-3: The addition of the
ensure
import is appropriate as it is used within thebatch
method to validate the return type.28-28: The
#invoker
property is correctly declared as optional since it is assigned later in theregister
method.97-108: The
batch
method has been updated to return a tuple containing the results array and an error string. Ensure that all usages of this method handle the new return type correctly.112-113: The
register
method correctly assigns the passedinvoker
to the#invoker
property. Ensure that theInvoker
is registered before any invocation occurs.116-117: The
waitClosed
method now returns a promise from theSession
'swait
method, which is the expected behavior for an asynchronous operation.94-120: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [120-125]
The
dispose
method correctly handles the session shutdown within a try-catch block, ignoring any errors that occur during shutdown.
- 129-131: The
ensurePromise
utility function is correctly implemented to wrap non-promise values in a promise, which is useful for ensuring consistent asynchronous behavior.denops/@denops-private/host/vim.ts (5)
1-1: The import of
ensure
andis
from an external module is appropriate for the new type checks introduced in thecall
andbatch
methods.60-70: The
call
method has been correctly updated to return aPromise
and includes proper error handling.72-78: The
batch
method has been correctly updated to return aPromise
with a readonly array as the result, which aligns with the new API contract.80-82: The
register
method has been updated to assign theinvoker
to a class property, which is a straightforward and correct change.113-114: The
dispose
method is correctly implemented to handle exceptions silently, which is appropriate for a cleanup function.denops/@denops-private/impl.ts (6)
1-4: The addition of the import statement for
ensure
andis
is appropriate for the new functionality introduced in thebatch
function.16-16: The introduction of the
isBatchReturn
constant is a good practice for type validation in thebatch
function.42-43: The use of
.then()
without a callback in theredraw
function is redundant and can be removed for clarity.- return this.#session.call("redraw", force).then(); + return this.#session.call("redraw", force);
- 65-66: The use of
.then()
without a callback in thecmd
function is redundant and can be removed for clarity.- return this.#session.call("call", "denops#api#cmd", cmd, ctx).then(); + return this.#session.call("call", "denops#api#cmd", cmd, ctx);
50-62: The changes to the
batch
function, including the use ofensure
for type validation and throwing aBatchError
, are correctly implemented.69-79: The modifications to the
eval
anddispatch
functions to return the result of the session call directly are consistent with the refactoring pattern applied to other functions in this file.denops/@denops-private/impl_test.ts (3)
1-6: The version numbers for the dependencies have been updated correctly.
13-30: The new test cases for
denops.redraw()
are well-structured and check for the expectedundefined
return value for different parameter scenarios.33-35: No changes detected in the remaining parts of the test file outside the hunk.
denops/@denops-private/service.ts (7)
1-10: The dependencies have been updated to newer versions. Ensure that the updated versions are backward compatible and do not introduce breaking changes.
34-38: The
Service
class constructor now requires ameta
parameter. Verify that all instantiations of theService
class have been updated accordingly.41-50: The
register
method has been simplified to only requirename
andscript
parameters. Ensure that all calls to this method have been updated to match the new signature.78-90: The
reload
method has been simplified to only accept thename
parameter. Verify that all calls to this method have been updated to match the new signature.107-109: The
dispose
method now usesdisposePlugin
for disposing of plugins. Ensure thatdisposePlugin
handles all necessary cleanup tasks.136-140: The
reload
dispatcher method has been updated to no longer accept atrace
parameter. Ensure that all dispatch calls toreload
have been updated to match the new signature.60-63: The
resolveScriptUrl
function has been updated. Verify that the new implementation correctly resolves script URLs in all scenarios where it is used.denops/@denops-private/util.ts (1)
- 1-9: The implementation of
isMeta
and the import statements are correct and follow best practices for type safety and maintainability.denops/@denops-private/worker/script.ts (5)
1-14: The imports have been updated to the latest version, and unused imports have been removed, which is good for maintaining up-to-date dependencies and clean code.
23-26: The new
emit
function is implemented correctly with proper error handling.28-36: The
main
function signature has been updated by removing thetrace
parameter, and the function has been updated accordingly.74-77: The
main
function now includes calls to the newemit
function, which seems to be used correctly to emit events before and after the plugin's main function is called.91-96: The event listener has been updated to use the
ensure
function withisMessageData
for validation, which is a good practice for type safety and ensures that the event data matches the expected schema.doc/denops.txt (3)
265-272: The addition of
denops#plugin#discover()
function is consistent with the summary and provides a way to automatically discover and register denops plugins. This should improve the usability and maintainability of the plugin system.273-282: The simplification of the
denops#plugin#register()
function signature by removing the optionalscript
andoptions
parameters is consistent with the summary and should make the plugin registration process more straightforward.284-287: The removal of the
options
parameter from thedenops#plugin#reload()
function is consistent with the summary and simplifies the reloading process.
Eliminated because the disadvantages of this feature are greater than the advantages it brings, and its presence is an obstacle to refactoring.
This is a minor but a breaking change. This change affects the `g:denops#debug` variable. After this commit, the variable must be configured prior to the denops initialization.
Now denops always skip registration or reload on invalid plugins.
We must use `console.warn()` instead of `console.log()` because stdout is used to tell proper address to the host.
Otherwise denops may not be ready on `DenopsReady`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (17)
- autoload/denops.vim (1 hunks)
- autoload/denops/_internal/server/chan.vim (1 hunks)
- autoload/denops/_internal/server/proc.vim (1 hunks)
- autoload/denops/plugin.vim (2 hunks)
- denops/@denops-private/cli.ts (3 hunks)
- denops/@denops-private/error.ts (1 hunks)
- denops/@denops-private/host/base.ts (2 hunks)
- denops/@denops-private/host/invoker.ts (2 hunks)
- denops/@denops-private/host/nvim.ts (4 hunks)
- denops/@denops-private/host/vim.ts (3 hunks)
- denops/@denops-private/impl.ts (3 hunks)
- denops/@denops-private/impl_test.ts (1 hunks)
- denops/@denops-private/service.ts (5 hunks)
- denops/@denops-private/util.ts (1 hunks)
- denops/@denops-private/version.ts (1 hunks)
- denops/@denops-private/worker/script.ts (3 hunks)
- doc/denops.txt (2 hunks)
Additional comments: 39
denops/@denops-private/util.ts (2)
1-2: The update to the import statements, including the new version of
unknownutil
, is correct.4-9: The
isMeta
definition correctly usesis.ObjectOf
to validate theMeta
type with specific properties.denops/@denops-private/error.ts (1)
- 1-1: The update to the import statement for the
is
function with the new version ofunknownutil
is correct.denops/@denops-private/host/base.ts (2)
1-2: The update to the import statements for
Disposable
andInvoker
with type declarations and new versions is correct.21-23: The
batch
method's signature has been correctly updated to usereadonly
for its parameters and return type, which is a good practice for immutability.denops/@denops-private/version.ts (1)
- 4-5: The update to the import statements for the
path
andsemver
modules with the new versions is correct.autoload/denops.vim (1)
- 21-26: The removal of the
denops#trace
configuration definition is consistent with the PR objectives and streamlines the configuration.denops/@denops-private/host/invoker.ts (3)
1-2: The update to the import statements for
unknownutil
and the type import forService
with the new version is correct.11-12: The simplification of the
register
method by removing unnecessary parameters aligns with the PR objectives to streamline the API.15-16: The simplification of the
reload
method by removing unnecessary parameters aligns with the PR objectives to streamline the API.denops/@denops-private/impl.ts (7)
1-1: The addition of the import statement for
ensure
andis
from the updated version ofunknownutil
is correct.42-43: The
redraw
method has been updated to return a promise directly, which is a more modern and concise approach.46-47: The
call
method has been updated to return a promise directly, which is a more modern and concise approach.50-62: The
batch
method has been updated to return a promise directly, which is a more modern and concise approach.65-66: The
cmd
method has been updated to return a promise directly, which is a more modern and concise approach.69-70: The
eval
method has been updated to return a promise directly, which is a more modern and concise approach.73-78: The
dispatch
method has been updated to return a promise directly, which is a more modern and concise approach.denops/@denops-private/cli.ts (2)
1-8: The update to the import statements with new versions and additional imports is correct.
26-60: The
handleConn
function has been updated to include additional logic for detecting hosts and handling services, which aligns with the PR objectives to enhance performance logging.denops/@denops-private/worker/script.ts (2)
1-14: The update to the import statements with new versions and the removal of unused imports is correct.
18-27: The refactoring of the
main
function to useisMessageData
and theemit
function for emitting events aligns with the PR objectives to streamline event handling.denops/@denops-private/host/vim.ts (1)
- 1-26: The addition of type checks using
is
fromunknownutil
and the new#dispatch
method enhance type safety and encapsulation of message handling.denops/@denops-private/host/nvim.ts (2)
1-27: The addition of type checks using
is
fromunknownutil
and the new#invoker
property enhance type safety and encapsulation of invoker handling.129-131: The
ensurePromise
function is a good addition to ensure that a value is always treated as a promise, improving code robustness.autoload/denops/_internal/server/chan.vim (1)
- 96-96: Verify that the change from
doautocmd
tos:rpcnotify
does not affect any plugins or event listeners that rely on theDenopsReady
event.autoload/denops/_internal/server/proc.vim (1)
- 73-74: The conditional addition of the
--quiet
flag based on theg:denops#debug
variable is a good practice to control verbosity based on the debug setting.denops/@denops-private/service.ts (4)
30-38: The addition of the
meta
property to theService
class constructor is a good practice for passing metadata, enhancing the class's functionality.41-50: The simplification of the
register
method by removing themeta
andtrace
parameters aligns with the removal of theg:denops#trace
configuration and streamlines the plugin registration process.78-90: The changes to the
reload
method, which now accepts only thename
parameter, simplify the code and align with the refactoring objectives.136-166: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [121-166]
The simplification of the
buildServiceSession
function by removing conditional trace logic aligns with the removal of theg:denops#trace
configuration and improves code maintainability.denops/@denops-private/impl_test.ts (1)
- 13-31: The new test case for
denops.redraw()
is well-structured and follows best practices by checking the function's behavior with different arguments. It's good to see multiple assertions covering different scenarios.autoload/denops/plugin.vim (4)
59-81: The deprecation warnings and argument handling in
denops#plugin#register
are correctly implemented. The function now guides users to the new expected usage, which is a good practice for backward compatibility.84-93: The deprecation warnings in
denops#plugin#reload
are correctly implemented, and the function now ignores any additional arguments, aligning with the updated function signature.96-107: The
denops#plugin#discover
function has been updated to remove the handling of options, and it now automatically discovers and registers plugins. This change simplifies the plugin discovery process.141-147: The
s:register
function has been updated to match the new plugin registration process, ensuring consistency across the codebase.doc/denops.txt (4)
90-95: The documentation update for
g:denops#debug
correctly reflects the changes in the codebase and provides clear information to the users about the debug mode.271-277: The documentation for the new
denops#plugin#discover
function is clear and accurately describes its purpose and behavior.279-283: The updates to the documentation for
denops#plugin#register
correctly reflect the changes to the function's behavior and signature, providing clarity on its usage.290-293: The documentation for
denops#plugin#reload
has been simplified to match the updated behavior of the function, which is now more efficient in handling plugin reloading.
this.#invoker = invoker; | ||
} | ||
|
||
async #dispatch(expr: unknown): Promise<unknown> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The #dispatch
method is marked as async
but does not contain any await
expressions, which could be removed for simplification.
- async #dispatch(expr: unknown): Promise<unknown> {
+ #dispatch(expr: unknown): Promise<unknown> {
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
async #dispatch(expr: unknown): Promise<unknown> { | |
#dispatch(expr: unknown): Promise<unknown> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (7)
- autoload/denops/_internal/job.vim (1 hunks)
- autoload/denops/_internal/path.vim (2 hunks)
- autoload/denops/_internal/server/chan.vim (3 hunks)
- autoload/denops/_internal/server/proc.vim (2 hunks)
- autoload/denops/_internal/wait.vim (1 hunks)
- autoload/denops/server.vim (1 hunks)
- autoload/health/denops.vim (5 hunks)
Files skipped from review due to trivial changes (2)
- autoload/denops/_internal/job.vim
- autoload/denops/server.vim
Files skipped from review as they are similar to previous changes (2)
- autoload/denops/_internal/server/chan.vim
- autoload/denops/_internal/server/proc.vim
Additional comments: 12
autoload/denops/_internal/path.vim (4)
1-2: The change from mutable variables to immutable constants for path separators and root directory is a good practice for values that should not change during runtime.
5-5: The update to use
s:SEP
in thedenops#_internal#path#join
function correctly reflects the refactoring to constants.22-22: The use of
s:ROOT
ands:SEP
in thes:script
function for Windows maintains consistency with the refactoring to constants.30-30: The use of
s:ROOT
in thes:script
function for non-Windows systems is consistent with the refactoring to constants.autoload/denops/_internal/wait.vim (1)
- 23-41: The refactoring of the
s:wait
function to usegetcharstr(0)
and manage consumed input withfeedkeys
is a significant improvement for handling user input during the waiting process. Ensure that this change has been tested thoroughly, especially the behavior offeedkeys
with different modes.autoload/health/denops.vim (7)
1-3: Changing version declarations to constants is a good practice to prevent accidental modification and to indicate that these values are fixed.
49-49: The use of
s:DENO_VERSION
in thes:check_deno_version
function correctly reflects the refactoring to constants.58-61: The comparison logic in
s:check_deno_version
usings:DENO_VERSION
is correct and aligns with the refactoring to constants.71-71: The use of
s:VIM_VERSION
in thes:check_vim_version
function correctly reflects the refactoring to constants.77-80: The comparison logic in
s:check_vim_version
usings:VIM_VERSION
is correct and aligns with the refactoring to constants.90-90: The use of
s:NEOVIM_VERSION
in thes:check_neovim_version
function correctly reflects the refactoring to constants.96-99: The comparison logic in
s:check_neovim_version
usings:NEOVIM_VERSION
is correct and aligns with the refactoring to constants.
Make it happen!
Summary by CodeRabbit
New Features
denops#plugin#discover()
function to automatically discover and register plugins.Enhancements
denops#plugin#register()
function by simplifying its signature.denops#plugin#reload()
function to improve performance and reliability.Bug Fixes
Refactor
Documentation
g:denops#trace
variable and the addition of new plugin discovery functionality.Chores