-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.ts
More file actions
45 lines (42 loc) · 1.13 KB
/
action.ts
File metadata and controls
45 lines (42 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type { Denops } from "@denops/std";
import type { Promish } from "./_typeutil.ts";
import type { Detail, DetailUnit, IdItem } from "./item.ts";
/**
* Parameters for invoking an action.
*/
export type InvokeParams<T extends Detail> = {
/**
* The item currently under the cursor.
*
* If `filteredItems` is empty, this will be `undefined`.
*/
readonly item?: IdItem<T> | undefined;
/**
* The items selected by the user.
*
* If no items were selected, this will be `undefined`.
*/
readonly selectedItems?: readonly IdItem<T>[] | undefined;
/**
* The items after filtering.
*/
readonly filteredItems: readonly IdItem<T>[];
};
/**
* An action that can be invoked from the picker.
*/
export type Action<T extends Detail = DetailUnit> = {
/**
* Invoke the action.
*
* @param denops - The Denops instance.
* @param params - Parameters for the action invocation.
* @param options - Additional options.
* @returns If the picker should remain open, return `true`.
*/
invoke(
denops: Denops,
params: InvokeParams<T>,
options: { signal?: AbortSignal },
): Promish<void | true>;
};