Skip to content

Commit dcf217d

Browse files
committed
Update arguments
1 parent 146cd0e commit dcf217d

File tree

3 files changed

+51
-70
lines changed

3 files changed

+51
-70
lines changed

denops/ddc/base/filter.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,28 @@ export type OnInitArguments<Params extends BaseParams> = {
1717
filterParams: Params;
1818
};
1919

20-
export type OnEventArguments<Params extends BaseParams> = {
20+
type BaseFilterArguments<Params extends BaseParams> = {
2121
denops: Denops;
2222
context: Context;
23-
onCallback: OnCallback;
2423
options: DdcOptions;
2524
filterOptions: FilterOptions;
2625
filterParams: Params;
2726
};
2827

29-
export type FilterArguments<Params extends BaseParams> = {
30-
denops: Denops;
31-
context: Context;
32-
onCallback: OnCallback;
33-
options: DdcOptions;
34-
sourceOptions: SourceOptions;
35-
filterOptions: FilterOptions;
36-
filterParams: Params;
37-
completeStr: string;
38-
items: Item[];
39-
};
28+
export type OnEventArguments<Params extends BaseParams> =
29+
& BaseFilterArguments<Params>
30+
& {
31+
onCallback: OnCallback;
32+
};
33+
34+
export type FilterArguments<Params extends BaseParams> =
35+
& BaseFilterArguments<Params>
36+
& {
37+
onCallback: OnCallback;
38+
sourceOptions: SourceOptions;
39+
completeStr: string;
40+
items: Item[];
41+
};
4042

4143
export abstract class BaseFilter<Params extends BaseParams> {
4244
name = "";

denops/ddc/base/source.ts

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,62 +20,51 @@ export type OnInitArguments<Params extends BaseParams> = {
2020
sourceParams: Params;
2121
};
2222

23-
export type OnEventArguments<Params extends BaseParams> = {
23+
type BaseSourceArguments<Params extends BaseParams> = {
2424
denops: Denops;
2525
context: Context;
26-
onCallback: OnCallback;
2726
options: DdcOptions;
2827
sourceOptions: SourceOptions;
2928
sourceParams: Params;
3029
};
3130

31+
export type OnEventArguments<Params extends BaseParams> =
32+
& BaseSourceArguments<Params>
33+
& {
34+
onCallback: OnCallback;
35+
};
36+
3237
export type OnCompleteDoneArguments<
3338
Params extends BaseParams,
3439
UserData extends unknown = unknown,
35-
> = {
36-
denops: Denops;
37-
context: Context;
40+
> = BaseSourceArguments<Params> & {
3841
onCallback: OnCallback;
39-
options: DdcOptions;
40-
sourceOptions: SourceOptions;
41-
sourceParams: Params;
4242
// To prevent users from accessing internal variables.
4343
userData: UserData;
4444
};
4545

4646
export type GetPreviewerArguments<
4747
Params extends BaseParams,
4848
UserData extends unknown = unknown,
49-
> = {
50-
denops: Denops;
51-
context: Context;
52-
options: DdcOptions;
53-
sourceOptions: SourceOptions;
54-
sourceParams: Params;
49+
> = BaseSourceArguments<Params> & {
5550
item: Item<UserData>;
5651
previewContext: PreviewContext;
5752
};
5853

59-
export type GetCompletePositionArguments<Params extends BaseParams> = {
60-
denops: Denops;
61-
context: Context;
62-
onCallback: OnCallback;
63-
options: DdcOptions;
64-
sourceOptions: SourceOptions;
65-
sourceParams: Params;
66-
};
54+
export type GetCompletePositionArguments<Params extends BaseParams> =
55+
& BaseSourceArguments<Params>
56+
& {
57+
onCallback: OnCallback;
58+
};
6759

68-
export type GatherArguments<Params extends BaseParams> = {
69-
denops: Denops;
70-
context: Context;
71-
onCallback: OnCallback;
72-
options: DdcOptions;
73-
sourceOptions: SourceOptions;
74-
sourceParams: Params;
75-
completePos: number;
76-
completeStr: string;
77-
isIncomplete?: boolean;
78-
};
60+
export type GatherArguments<Params extends BaseParams> =
61+
& BaseSourceArguments<Params>
62+
& {
63+
onCallback: OnCallback;
64+
completePos: number;
65+
completeStr: string;
66+
isIncomplete?: boolean;
67+
};
7968

8069
export abstract class BaseSource<
8170
Params extends BaseParams,

denops/ddc/base/ui.ts

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,29 @@ export type OnInitArguments<Params extends BaseParams> = {
1414
uiParams: Params;
1515
};
1616

17-
export type SkipCompletionArguments<Params extends BaseParams> = {
17+
type BaseUiArguments<Params extends BaseParams> = {
1818
denops: Denops;
1919
context: Context;
2020
options: DdcOptions;
2121
uiOptions: UiOptions;
2222
uiParams: Params;
2323
};
2424

25-
export type ShowArguments<Params extends BaseParams> = {
26-
denops: Denops;
27-
context: Context;
28-
options: DdcOptions;
29-
completePos: number;
30-
items: DdcItem[];
31-
uiOptions: UiOptions;
32-
uiParams: Params;
33-
};
25+
export type SkipCompletionArguments<Params extends BaseParams> =
26+
BaseUiArguments<Params>;
3427

35-
export type HideArguments<Params extends BaseParams> = {
36-
denops: Denops;
37-
context: Context;
38-
options: DdcOptions;
39-
uiOptions: UiOptions;
40-
uiParams: Params;
41-
};
28+
export type ShowArguments<Params extends BaseParams> =
29+
& BaseUiArguments<Params>
30+
& {
31+
completePos: number;
32+
items: DdcItem[];
33+
};
4234

43-
export type VisibleArguments<Params extends BaseParams> = {
44-
denops: Denops;
45-
context: Context;
46-
options: DdcOptions;
47-
uiOptions: UiOptions;
48-
uiParams: Params;
49-
};
35+
export type HideArguments<Params extends BaseParams> = BaseUiArguments<Params>;
36+
37+
export type VisibleArguments<Params extends BaseParams> = BaseUiArguments<
38+
Params
39+
>;
5040

5141
export abstract class BaseUi<Params extends BaseParams> {
5242
name = "";

0 commit comments

Comments
 (0)