From 315d3ac9843eee5e7f55e9b1ebcdd8c5d2c5d77a Mon Sep 17 00:00:00 2001 From: Alisue Date: Sun, 7 Jul 2024 16:35:13 +0900 Subject: [PATCH] :package: Use `@denops/core` v7.0.0-pre0 --- denops.ts | 8 +++++++- plugin.ts | 2 +- stub.ts | 17 ++++++++++++++++- stub_test.ts | 2 +- tester.ts | 2 +- with.ts | 2 +- with_test.ts | 2 +- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/denops.ts b/denops.ts index 958f993..2c53d30 100644 --- a/denops.ts +++ b/denops.ts @@ -1,10 +1,16 @@ -import type { Context, Denops, Dispatcher, Meta } from "jsr:@denops/core@6.0.6"; +import type { + Context, + Denops, + Dispatcher, + Meta, +} from "jsr:@denops/core@7.0.0-pre0"; import type { Client } from "jsr:@lambdalisue/messagepack-rpc@2.1.1"; export class DenopsImpl implements Denops { readonly name: string; readonly meta: Meta; readonly context: Record = {}; + readonly interrupted = AbortSignal.any([]); dispatcher: Dispatcher = {}; diff --git a/plugin.ts b/plugin.ts index 4085044..dfa5dba 100644 --- a/plugin.ts +++ b/plugin.ts @@ -1,4 +1,4 @@ -import type { Denops } from "jsr:@denops/core@6.0.6"; +import type { Denops } from "jsr:@denops/core@7.0.0-pre0"; import { assert, ensure, is } from "jsr:@core/unknownutil@3.18.0"; import { Client, Session } from "jsr:@lambdalisue/messagepack-rpc@2.1.1"; import { errorDeserializer, errorSerializer } from "./error.ts"; diff --git a/stub.ts b/stub.ts index e6bbf65..ea16997 100644 --- a/stub.ts +++ b/stub.ts @@ -1,4 +1,9 @@ -import type { Context, Denops, Dispatcher, Meta } from "jsr:@denops/core@6.0.6"; +import type { + Context, + Denops, + Dispatcher, + Meta, +} from "jsr:@denops/core@7.0.0-pre0"; /** * Represents a stubber object for `Denops`. @@ -22,6 +27,12 @@ export interface DenopsStubber { * ``` */ meta?: Meta; + + /** + * AbortSignal instance that is triggered when the user invoke `denops#interrupt()` + * If not specified, it returns a new instance of `AbortSignal`. + */ + interrupted?: AbortSignal; /** * A stub function for the `redraw` method of `Denops`. * If not specified, it returns a promise resolving to undefined. @@ -96,6 +107,10 @@ export class DenopsStub implements Denops { }; } + get interrupted(): AbortSignal { + return this.#stubber.interrupted ?? AbortSignal.any([]); + } + /** * A stub function for the `redraw` method of `Denops`. * If not specified, it returns a promise resolving to undefined. diff --git a/stub_test.ts b/stub_test.ts index 3aaad26..beb5438 100644 --- a/stub_test.ts +++ b/stub_test.ts @@ -1,6 +1,6 @@ import { assertSpyCall, spy } from "jsr:@std/testing@0.224.0/mock"; import { assertEquals } from "jsr:@std/assert@0.225.1"; -import type { Denops } from "jsr:@denops/core@6.0.6"; +import type { Denops } from "jsr:@denops/core@7.0.0-pre0"; import { DenopsStub } from "./stub.ts"; Deno.test("`DenopsStub`", async (t) => { diff --git a/tester.ts b/tester.ts index 21476c1..9032fdc 100644 --- a/tester.ts +++ b/tester.ts @@ -1,5 +1,5 @@ import { sample } from "jsr:@std/collections@0.224.1/sample"; -import type { Denops } from "jsr:@denops/core@6.0.6"; +import type { Denops } from "jsr:@denops/core@7.0.0-pre0"; import type { RunMode } from "./runner.ts"; import { withDenops } from "./with.ts"; diff --git a/with.ts b/with.ts index ec6f5c1..b5ea6a7 100644 --- a/with.ts +++ b/with.ts @@ -1,7 +1,7 @@ import { deadline } from "jsr:@std/async@0.224.0/deadline"; import { assert, is } from "jsr:@core/unknownutil@3.18.0"; import { Client, Session } from "jsr:@lambdalisue/messagepack-rpc@2.1.1"; -import type { Denops, Meta } from "jsr:@denops/core@6.0.6"; +import type { Denops, Meta } from "jsr:@denops/core@7.0.0-pre0"; import { getConfig } from "./conf.ts"; import { run, type RunMode } from "./runner.ts"; import { DenopsImpl } from "./denops.ts"; diff --git a/with_test.ts b/with_test.ts index 3d14af8..1ad8772 100644 --- a/with_test.ts +++ b/with_test.ts @@ -6,7 +6,7 @@ import { assertRejects, } from "jsr:@std/assert@0.225.1"; import { assertSpyCalls, spy, stub } from "jsr:@std/testing@0.224.0/mock"; -import type { Denops } from "jsr:@denops/core@6.0.6"; +import type { Denops } from "jsr:@denops/core@7.0.0-pre0"; import { withDenops } from "./with.ts"; Deno.test("test(mode:vim) start vim to test denops features", async () => {