Closed lambdalisue closed 5 months ago
The changes bring enhancements to the denops
framework, focusing on plugin event management and service improvements. These updates aim to streamline plugin loading processes and provide better monitoring capabilities during runtime.
File Path | Summary of Changes |
---|---|
denops/@denops-private/denops.ts |
Modified Service type to include waitLoaded , updated DenopsImpl for asynchronous plugin loading |
denops/@denops-private/denops_test.ts |
Added waitLoaded() method, updated test cases for asynchronous loading |
denops/@denops-private/service.ts |
Added plugin load event dispatching methods, introduced #waiters map for managing waiters |
denops/@denops-private/service_test.ts |
Replaced assertThrows with assertRejects in load() method test |
🐇✨ In the realm of code, where the bits align, A rabbit hopped through, leaving changes behind. Events now dance, from start to end, In a digital burrow, where scripts befriend. Cheers to the devs, from dusk till dawn, With every commit, a new day is born. 🌟🐰
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?
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 90.01%. Comparing base (
2a39384
) to head (897bda7
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
dispatch fails if plugin registered and populate dispatcher at mod.main()
not completed
test with
test_a/main.ts
import type { Denops } from "https://deno.land/x/denops_std@v6.0.1/mod.ts";
export async function main(denops: Denops) {
await new Promise((resolve) => setTimeout(resolve, 100));
await denops.dispatch("test_b", "hello");
}
test_a/main.ts
import type { Denops } from "https://deno.land/x/denops_std@v6.0.1/mod.ts";
export async function main(denops: Denops) {
await new Promise((resolve) => setTimeout(resolve, 200));
denops.dispatcher = {
hello() {
console.log("hello");
},
};
await denops.dispatch("test_b", "hello");
}
Followed https://github.com/vim-denops/denops.vim/pull/340#discussion_r1596196987, most of code is re-written from scratch so I rebased & force pushed.
Now, denops.dispatch() automatically waits for the target plugin to load, enabling child plugins (e.g., Shougo/ddu-ui-filter for Shougo/ddu) to call the parent plugin's API at any time.
Summary by CodeRabbit
New Features
Service
type to includewaitLoaded
in addition todispatch
.waitLoaded()
to theservice
object.Bug Fixes
assertThrows
withassertRejects
in theload()
method test for better error handling.Documentation